build(pub): 更新依赖

This commit is contained in:
李东云
2023-03-20 15:52:49 +08:00
parent 1e0e834197
commit 16a42bd6b3
24 changed files with 104 additions and 122 deletions

View File

@@ -14,7 +14,6 @@ class App extends StatefulWidget {
class _AppState extends State<App> {
@override
Widget build(BuildContext context) {
// TODO: implement build
return LayoutScaffold(
appBar: AppBar(
title: const Text('满席'),

View File

@@ -29,12 +29,12 @@ class AccessControlFilter extends StatefulWidget {
}) : super(key: key);
@override
_AccessControlFilterState createState() => _AccessControlFilterState();
AccessControlFilterState createState() => AccessControlFilterState();
}
class _AccessControlFilterState extends State<AccessControlFilter> {
class AccessControlFilterState extends State<AccessControlFilter> {
/// 登录状态
bool _isLogin = false;
final bool _isLogin = false;
@override
void initState() {
@@ -65,9 +65,13 @@ class _AccessControlFilterState extends State<AccessControlFilter> {
// 缺省的未登录情况下的显示
return Center(
child: RaisedButton(
color: Colors.blueAccent,
textTheme: ButtonTextTheme.primary,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Theme.of(context).colorScheme.background,
textStyle: TextStyle(
color: Theme.of(context).colorScheme.primary
)
),
child: const Text('请先登录'),
onPressed: () {
Navigator.push(

View File

@@ -70,7 +70,7 @@ class Global {
static List<MaterialColor> get themes => _themes;
// 是否为release版
static bool get isRelease => bool.fromEnvironment("dart.vm.product");
static bool get isRelease => const bool.fromEnvironment("dart.vm.product");
//初始化全局信息会在APP启动时执行
static Future init() async {
@@ -80,13 +80,13 @@ class Global {
// 初始化用户信息
_prefs = await SharedPreferences.getInstance();
var _profile = _prefs?.getString("user_info");
if (_profile != null) {
var profile = _prefs?.getString("user_info");
if (profile != null) {
try {
if (kDebugMode) {
print('开始读取用户信息...');
}
profile = jsonDecode(_profile);
profile = jsonDecode(profile);
if (kDebugMode) {
print('用户信息读取成功');
}

View File

@@ -14,10 +14,10 @@ class LayoutScaffold extends StatelessWidget {
@override
Widget build(BuildContext context) {
Text title = appBar.title as Text;
print(appBar.preferredSize);
return Scaffold(
appBar: PreferredSize(
preferredSize: const Size.fromHeight(60),
child: AppBar(
actions: appBar.actions,
leading: appBar.leading,
@@ -34,7 +34,6 @@ class LayoutScaffold extends StatelessWidget {
statusBarIconBrightness: Brightness.dark,
),
),
preferredSize: const Size.fromHeight(60),
),
body: body,
);

View File

@@ -125,7 +125,7 @@ class _LifeState extends State<Life> {
return Card(
key: ValueKey(item["id"]),
elevation: 8,
color: Theme.of(context).backgroundColor,
color: Theme.of(context).colorScheme.background,
child: Column(
children: <Widget>[
InkWell(

View File

@@ -1,8 +1,9 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
//import 'common/access_control_filter.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart'
if (dart.library.html) 'package:flutter_native_splash/flutter_native_splash_web.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart';
// import 'package:flutter_native_splash/flutter_native_splash_web.dart';
// import 'package:flutter_localizations/flutter_localizations.dart';
import 'app.dart';
@@ -30,16 +31,15 @@ class Bistro extends StatelessWidget {
primaryColor: const Color(0xFFff857a),
// primaryColor: const Color(0xFF5f2500),
primaryColorDark: Colors.white60,
backgroundColor: const Color(0xFFFFF7F8),
// backgroundColor: const Color(0xFFcf9237),
bottomAppBarColor: const Color(0xFFFFF7F8),
appBarTheme: const AppBarTheme(color: Colors.white),
// appBarTheme: const AppBarTheme(color: Color(0xFF5f2500)),
bottomAppBarTheme: const BottomAppBarTheme(color: Color(0xFFFFF7F8)),
colorScheme: ColorScheme.fromSwatch(
primarySwatch: Colors.amber,
).copyWith(
secondary: Colors.deepOrangeAccent,
),
)
.copyWith(
secondary: Colors.deepOrangeAccent,
)
.copyWith(background: const Color(0xFFFFF7F8)),
),
home: const BistroFrame(
title: '小酒馆',
@@ -65,10 +65,10 @@ class BistroFrame extends StatefulWidget {
final String title;
@override
_BistroFrameState createState() => _BistroFrameState();
BistroFrameState createState() => BistroFrameState();
}
class _BistroFrameState extends State<BistroFrame> {
class BistroFrameState extends State<BistroFrame> {
late Widget _body;
int _index = 3;
@@ -108,14 +108,14 @@ class _BistroFrameState extends State<BistroFrame> {
void initData() {
_body = IndexedStack(
children: <Widget>[
const App(),
News(),
News(),
const Life(),
const Mine(),
],
index: _index,
children: const <Widget>[
App(),
News(),
News(),
Life(),
Mine(),
],
);
}
@@ -123,13 +123,21 @@ class _BistroFrameState extends State<BistroFrame> {
// This is where you can initialize the resources needed by your app while
// the splash screen is displayed. Remove the following example because
// delaying the user experience is a bad design practice!
print('ready in 3...');
// if (kDebugMode) {
// print('ready in 3...');
// }
// await Future.delayed(const Duration(seconds: 1));
if (kDebugMode) {
print('ready in 2...');
}
await Future.delayed(const Duration(seconds: 1));
print('ready in 2...');
if (kDebugMode) {
print('ready in 1...');
}
await Future.delayed(const Duration(seconds: 1));
print('ready in 1...');
await Future.delayed(const Duration(seconds: 1));
print('go!');
if (kDebugMode) {
print('go!');
}
FlutterNativeSplash.remove();
}
@@ -148,12 +156,12 @@ class _BistroFrameState extends State<BistroFrame> {
bottomNavigationBar: BottomAppBar(
shape: const CircularNotchedRectangle(),
child: Row(
children: bottomNavigationBarData,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: bottomNavigationBarData,
),
),
floatingActionButton: FloatingActionButton(
backgroundColor: Theme.of(context).backgroundColor,
backgroundColor: Theme.of(context).colorScheme.background,
onPressed: () => {},
child: Icon(
Icons.search,

View File

@@ -12,13 +12,12 @@ class Login extends StatefulWidget {
}) : super(key: key);
@override
_LoginState createState() => _LoginState();
LoginState createState() => LoginState();
}
class _LoginState extends State<Login> {
class LoginState extends State<Login> {
@override
Widget build(BuildContext context) {
// TODO: implement build
return Scaffold(
appBar: AppBar(
title: const Text(
@@ -30,6 +29,6 @@ class _LoginState extends State<Login> {
centerTitle: true,
),
body: const Text('登录'),
);;
);
}
}

View File

@@ -3,6 +3,8 @@ import 'package:flutter/material.dart';
import 'layout/layout_scaffold.dart';
class News extends StatelessWidget {
const News({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return LayoutScaffold(

View File

@@ -1,5 +1,5 @@
import 'package:bistro/app.dart';
var router = {
'/app': (context) => App(), //应用页
'/app': (context) => const App(), //应用页
};