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/
# Web related
lib/generated_plugin_registrant.dart
# Symbolication related
app.*.symbols

View File

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

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<bitmap android:gravity="fill" android:src="@drawable/background"/>
<bitmap android:src="@drawable/background"/>
</item>
</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:forceDarkAllowed">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</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

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> {
@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(
)
.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...');
await Future.delayed(const Duration(seconds: 1));
// 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));
if (kDebugMode) {
print('ready in 1...');
}
await Future.delayed(const Duration(seconds: 1));
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(), //应用页
};

View File

@@ -58,7 +58,7 @@ dependencies:
dio_http_cache: ^0.3.0
# 启动页
flutter_native_splash: ^2.2.0+1
flutter_native_splash: ^2.2.19
dev_dependencies:
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
# size of the app. Only one parameter can be used, color and background_image cannot both be set.
# 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
# the leading # character.
# 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.
# 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
# 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.
#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,
# 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
# 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
# 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>
<html>
<head>
<!DOCTYPE html><html><head>
<!--
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.
@@ -27,12 +25,12 @@
<link rel="apple-touch-icon" href="icons/Icon-192.png">
<!-- Favicon -->
<link rel="icon" type="image/png" href="favicon.png"/>
<link rel="icon" type="image/png" href="favicon.png">
<title>bistro</title>
<link rel="manifest" href="manifest.json">
<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">
</head>
<body>
@@ -103,5 +101,5 @@
loadMainDartJs();
}
</script>
</body>
</html>
</body></html>

View File

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

View File

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