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

1
.gitignore vendored
View File

@@ -32,7 +32,6 @@
/build/ /build/
# Web related # Web related
lib/generated_plugin_registrant.dart
# Symbolication related # Symbolication related
app.*.symbols app.*.symbols

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item> <item>
<bitmap android:gravity="fill" android:src="@drawable/background"/> <bitmap android:src="@drawable/background"/>
</item> </item>
</layer-list> </layer-list>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item> <item>
<bitmap android:gravity="fill" android:src="@drawable/background"/> <bitmap android:src="@drawable/background"/>
</item> </item>
</layer-list> </layer-list>

View File

@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowSplashScreenBackground">@drawable/launch_background</item>
<item name="android:forceDarkAllowed">false</item>
<item name="android:windowFullscreen">true</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>

View File

@@ -7,6 +7,8 @@
<item name="android:windowBackground">@drawable/launch_background</item> <item name="android:windowBackground">@drawable/launch_background</item>
<item name="android:forceDarkAllowed">false</item> <item name="android:forceDarkAllowed">false</item>
<item name="android:windowFullscreen">true</item> <item name="android:windowFullscreen">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
</style> </style>
<!-- Theme applied to the Android Window as soon as the process has started. <!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your This theme determines the color of the Android Window while your

View File

@@ -1,23 +0,0 @@
{
"images" : [
{
"filename" : "BrandingImage.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "BrandingImage@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "BrandingImage@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 B

After

Width:  |  Height:  |  Size: 69 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 B

After

Width:  |  Height:  |  Size: 69 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 B

After

Width:  |  Height:  |  Size: 69 B

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -58,7 +58,7 @@ dependencies:
dio_http_cache: ^0.3.0 dio_http_cache: ^0.3.0
# 启动页 # 启动页
flutter_native_splash: ^2.2.0+1 flutter_native_splash: ^2.2.19
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
@@ -131,28 +131,29 @@ flutter_native_splash:
# splash screen to a png image. This is useful for gradients. The image will be stretch to the # splash screen to a png image. This is useful for gradients. The image will be stretch to the
# size of the app. Only one parameter can be used, color and background_image cannot both be set. # size of the app. Only one parameter can be used, color and background_image cannot both be set.
# color: "#e1f5fe" # color: "#e1f5fe"
background_image: "res/assets/images/Splash.png" # background_image: "res/assets/images/Splash.png"
# Optional parameters are listed below. To enable a parameter, uncomment the line by removing # Optional parameters are listed below. To enable a parameter, uncomment the line by removing
# the leading # character. # the leading # character.
# The image parameter allows you to specify an image used in the splash screen. It must be a # The image parameter allows you to specify an image used in the splash screen. It must be a
# png file and should be sized for 4x pixel density. # png file and should be sized for 4x pixel density.
# image: assets/logo_lockup_flutter_vertical.png # image: assets/logo_lockup_flutter_vertical.png
# image: "res/assets/images/Splash.png"
# This property allows you to specify an image used as branding in the splash screen. It must be # This property allows you to specify an image used as branding in the splash screen. It must be
# a png file. Currently, it is only supported for Android and iOS. # a png file. Currently, it is only supported for Android and iOS.
#branding: assets/dart.png branding: assets/dart.png
# Specify your branding image for dark mode. # Specify your branding image for dark mode.
#branding_dark: assets/dart_dark.png branding_dark: assets/dart_dark.png
# To position the branding image at the bottom of the screen you can use bottom, bottomRight, # To position the branding image at the bottom of the screen you can use bottom, bottomRight,
# and bottomLeft. The default values is bottom if not specified or specified something else. # and bottomLeft. The default values is bottom if not specified or specified something else.
# #
# Make sure this content mode value should not be similar to android_gravity value and # Make sure this content mode value should not be similar to android_gravity value and
# ios_content_mode value. # ios_content_mode value.
#branding_mode: bottom branding_mode: bottom
# The color_dark, background_image_dark, and image_dark are parameters that set the background # The color_dark, background_image_dark, and image_dark are parameters that set the background
# and image when the device is in dark mode. If they are not specified, the app will use the # and image when the device is in dark mode. If they are not specified, the app will use the

View File

@@ -1,6 +1,4 @@
<!DOCTYPE html> <!DOCTYPE html><html><head>
<html>
<head>
<!-- <!--
If you are serving your web app in a path other than the root, change the If you are serving your web app in a path other than the root, change the
href value below to reflect the base path you are serving from. href value below to reflect the base path you are serving from.
@@ -27,12 +25,12 @@
<link rel="apple-touch-icon" href="icons/Icon-192.png"> <link rel="apple-touch-icon" href="icons/Icon-192.png">
<!-- Favicon --> <!-- Favicon -->
<link rel="icon" type="image/png" href="favicon.png"/> <link rel="icon" type="image/png" href="favicon.png">
<title>bistro</title> <title>bistro</title>
<link rel="manifest" href="manifest.json"> <link rel="manifest" href="manifest.json">
<script src="splash/splash.js"></script> <script src="splash/splash.js"></script>
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport"/> <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
<link rel="stylesheet" type="text/css" href="splash/style.css"> <link rel="stylesheet" type="text/css" href="splash/style.css">
</head> </head>
<body> <body>
@@ -103,5 +101,5 @@
loadMainDartJs(); loadMainDartJs();
} }
</script> </script>
</body>
</html> </body></html>

View File

@@ -1,7 +1,5 @@
function removeSplashFromWeb() { function removeSplashFromWeb() {
const elem = document.getElementById("splash"); document.getElementById("splash")?.remove();
if (elem) { document.getElementById("splash-branding")?.remove();
elem.remove();
}
document.body.style.background = "transparent"; document.body.style.background = "transparent";
} }

View File

@@ -1,7 +1,11 @@
html {
height: 100%
}
body { body {
margin:0; margin: 0;
height:100%; min-height: 100%;
background: #000000; background-color: #ffffff;
background-image: url("img/light-background.png"); background-image: url("img/light-background.png");
background-size: 100% 100%; background-size: 100% 100%;
} }
@@ -32,12 +36,22 @@ body {
object-fit: cover; object-fit: cover;
} }
@media (prefers-color-scheme: dark) { .bottom {
body { position: absolute;
margin:0; bottom: 0;
height:100%; left: 50%;
background: #000000; -ms-transform: translate(-50%, 0);
background-image: url("img/dark-background.png"); transform: translate(-50%, 0);
background-size: 100% 100%; }
}
.bottomLeft {
position: absolute;
bottom: 0;
left: 0;
}
.bottomRight {
position: absolute;
bottom: 0;
right: 0;
} }