Support Flutter 3.22.2

Support Flutter 3.22.2
This commit is contained in:
Binance3980
2024-07-01 15:26:49 +08:00
parent c91ea3ab5c
commit 64cf920b59
101 changed files with 260 additions and 1951 deletions
+3 -2
View File
@@ -1,11 +1,12 @@
class AppUrls {
static const String baseUrl = "https://uu.lanmao123.com";
static const String baseUrl = "https://api.0009.uk";
static const String baseApiUrl = '$baseUrl/api/v1'; // 基础接口地址
static const String login = '$baseApiUrl/passport/auth/login';
static const String register = '$baseApiUrl/passport/auth/register';
static const String getQuickLoginUrl = '$baseApiUrl/passport/auth/getQuickLoginUrl';
static const String getQuickLoginUrl =
'$baseApiUrl/passport/auth/getQuickLoginUrl';
static const String userSubscribe = '$baseApiUrl/user/getSubscribe';
static const String plan = '$baseApiUrl/guest/plan/fetch';
+7 -6
View File
@@ -55,18 +55,19 @@ class ServerEntity {
groupId: List<String>.from(json["group_id"]?.map((x) => x) ?? []),
parentId: json["parent_id"],
tags: List<String>.from(json["tags"]?.map((x) => x) ?? []),
name: json["name"],
name: "" + json["name"],
rate: json["rate"],
host: json["host"],
port: json["port"] ?? "",
serverPort: json["server_port"],
cipher: json["cipher"] ?? "" ,
host: json["host"] + "",
port: int.parse(json["port"] ?? "0"),
serverPort:
int.parse(json["server_port"] ?? "0"), //json["server_port"],
cipher: json["cipher"] ?? "",
show: json["show"],
sort: json["sort"],
createdAt: json["created_at"],
updatedAt: json["updated_at"],
type: json["type"],
lastCheckAt: "",//json["last_check_at"] +
lastCheckAt: "", //json["last_check_at"] +
);
Map<String, dynamic> toMap() => {
+2 -1
View File
@@ -13,7 +13,8 @@ class ErrorInterceptor extends Interceptor {
DioHttpException appException = DioHttpException.create(err);
// 错误提示
print('DioError===: ${appException.toString()}');
err.error = appException;
// err.error = appException;
super.onError(err, handler);
}
}
-6
View File
@@ -65,11 +65,6 @@ class SailApp extends StatelessWidget {
services.DeviceOrientation.portraitUp,
services.DeviceOrientation.portraitDown
]);
// final size = MediaQuery.of(context).size;
// final width = size.width;
// final height = size.height;
// print('width is $width; height is $height');
// ScreenUtil.init(context);
return MaterialApp(
// <--- /!\ Add the builder
@@ -78,7 +73,6 @@ class SailApp extends StatelessWidget {
debugShowCheckedModeBanner: false,
onGenerateRoute: Application.router?.generator,
localizationsDelegates: const [
// 本地化的代理类
AppLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
+3 -42
View File
@@ -1,5 +1,6 @@
// ignore_for_file: file_names
import 'package:flutter/material.dart';
import 'package:sail/resources/app_theme.dart';
class ThemeCollection extends ChangeNotifier {
/// _colorSwatch method or function take RGB color as argument and after processing
@@ -28,46 +29,6 @@ class ThemeCollection extends ChangeNotifier {
notifyListeners();
}
// ThemeData themeData = ThemeData(
// primarySwatch: AppColors.themeColor,
// visualDensity: VisualDensity.adaptivePlatformDensity,
// );
ThemeData get getActiveTheme => isDarkActive ? _darkTheme : lightTheme;
// Let's define a light theme for our Application
ThemeData get lightTheme => ThemeData(
primarySwatch: MaterialColor(0xffFFFFFF, _colorSwatch(1, 117, 194)),
primaryColor: Colors.green,
// accentColor: const Color(0xffAE77FF),
canvasColor: const Color(0xffFFFFFF),
// backgroundColor: const Color(0xffFFFFFF),
iconTheme: const IconThemeData(color: Colors.green),
primaryTextTheme: TextTheme(
bodyText1: const TextStyle(color: Colors.black, fontSize: 15),
bodyText2: const TextStyle(color: Colors.black54, fontSize: 15),
subtitle1: const TextStyle(color: Colors.black),
headline3: const TextStyle(
color: Colors.black, fontSize: 27, fontWeight: FontWeight.bold),
headline6: const TextStyle(color: Colors.black),
caption: TextStyle(
color: Colors.grey.shade700, wordSpacing: -1, fontSize: 12)));
// Now define a dark theme for our Application
ThemeData get _darkTheme => ThemeData(
primarySwatch: MaterialColor(0xff0B0415, _colorSwatch(2, 86, 155)),
primaryColor: Colors.green,
// accentColor: const Color(0xffAE77FF),
canvasColor: const Color(0xff0B0415),
// backgroundColor: const Color(0xff0B0415),
iconTheme: const IconThemeData(color: Colors.white),
primaryTextTheme: const TextTheme(
bodyText1: TextStyle(color: Colors.white, fontSize: 15),
bodyText2: TextStyle(color: Colors.white70, fontSize: 15),
subtitle1: TextStyle(color: Colors.white),
headline3: TextStyle(
color: Colors.white, fontSize: 27, fontWeight: FontWeight.bold),
headline6: const TextStyle(color: Colors.white),
caption:
TextStyle(color: Colors.white54, wordSpacing: -1, fontSize: 12)));
ThemeData get getActiveTheme =>
isDarkActive ? AppTheme.lightThemeData : AppTheme.darkThemeData;
}
+5 -5
View File
@@ -78,7 +78,7 @@ For more information, please read our Privacy Policy
color: Color.fromARGB(255, 34, 128, 15).withOpacity(0.7)),
child: Text(
'Accept and continue',
style: Theme.of(context).primaryTextTheme.headline6!.copyWith(
style: Theme.of(context).primaryTextTheme.labelMedium!.copyWith(
color: AppColors.whiteColor,
),
),
@@ -87,7 +87,7 @@ For more information, please read our Privacy Policy
Text(
' ',
textAlign: TextAlign.center,
style: Theme.of(context).primaryTextTheme.caption,
style: Theme.of(context).primaryTextTheme.labelMedium,
),
],
),
@@ -114,7 +114,7 @@ For more information, please read our Privacy Policy
lt,
style: Theme.of(context)
.primaryTextTheme
.headline6!
.labelMedium!
.copyWith(color: Colors.white),
),
if (isDiscount)
@@ -137,14 +137,14 @@ For more information, please read our Privacy Policy
text: rt_1,
style: Theme.of(context)
.primaryTextTheme
.headline6!
.labelMedium!
.copyWith(color: Colors.white),
children: [
TextSpan(
text: ' $rt_2',
style: Theme.of(context)
.primaryTextTheme
.bodyText1!
.labelMedium!
.copyWith(color: Colors.white),
)
])),
+12 -8
View File
@@ -82,12 +82,12 @@ class AccountState extends State<AccountPage> {
onTap: onTap ?? null,
minLeadingWidth: 35,
dense: true,
title:
Text(title, style: Theme.of(context).primaryTextTheme.subtitle1),
title: Text(title,
style: Theme.of(context).primaryTextTheme.labelMedium),
subtitle: subtitle != null
? Text(
subtitle,
style: Theme.of(context).primaryTextTheme.caption,
style: Theme.of(context).primaryTextTheme.labelMedium,
)
: null,
// leading: sysicon ??
@@ -115,7 +115,7 @@ class AccountState extends State<AccountPage> {
'Upgrade',
style: Theme.of(context)
.primaryTextTheme
.bodyText1!
.labelMedium!
.copyWith(color: Colors.white),
),
));
@@ -136,9 +136,13 @@ class AccountState extends State<AccountPage> {
Widget build(BuildContext context) {
bool isDarkTheme = Provider.of<ThemeCollection>(context).isDarkActive;
return Scaffold(
backgroundColor: isDarkTheme ? Color(0xff0B0415) : Colors.white,
appBar: AppBar(
shadowColor: Colors.transparent,
title: const Text('Settings'),
foregroundColor: isDarkTheme ? Colors.white : Color(0xff0B0415),
backgroundColor: Colors.transparent,
title: Text(
'Settings',
),
),
body: build2(context),
);
@@ -200,7 +204,7 @@ class AccountState extends State<AccountPage> {
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: Text(
'Looks like Youre not signed in yet.',
style: Theme.of(context).primaryTextTheme.bodyText1,
style: Theme.of(context).primaryTextTheme.labelMedium,
),
),
@@ -251,7 +255,7 @@ class AccountState extends State<AccountPage> {
builder: (builder) => const SettingsRoute()))),
divider,
Text("App Version: 1.0.6",
style: Theme.of(context).primaryTextTheme.subtitle1),
style: Theme.of(context).primaryTextTheme.labelMedium),
/*userModel.isLogin
? GestureDetector(
onTap: () => {
+7 -195
View File
@@ -124,16 +124,10 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
print('state = $state');
if (state == AppLifecycleState.resumed) {
_planModel.fetchPlanList();
// _appModel.getStatus();
// print("_appModel.isOn: ${_appModel.isOn}");
}
if (state == AppLifecycleState.inactive) {
//激活状态
_appModel.getStatus();
print("_appModel.isOn: ${_appModel.isOn}");
}
}
@@ -179,30 +173,13 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
ScreenUtil.init(context,
designSize: const Size(AppDimens.maxWidth, AppDimens.maxHeight));
//是否第一次打开app
// Future.delayed(Duration(seconds: 3), () {
// _showCupertinoAlertDialog(
// context: context,
// title: "提示",
// content: "您没有提交的权限,\n当前仅供查阅",
// sureText: "确定"
// );
// });
// Provider.of<ThemeCollection>(context)
// .getActiveTheme
// .primaryTextTheme
// .bodyLarge
bool isDarkTheme = Provider.of<ThemeCollection>(context).isDarkActive;
final ButtonStyle style = TextButton.styleFrom(
foregroundColor: Theme.of(context).colorScheme.onPrimary,
);
return Scaffold(
backgroundColor: isDarkTheme ? Color(0xff0B0415) : Colors.white,
appBar: AppBar(
shadowColor: Colors.transparent,
backgroundColor: Colors.transparent,
title: SvgPicture.asset(
'assets/text2.svg',
height: 28,
@@ -210,6 +187,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
),
actions: <Widget>[
IconButton(
color: isDarkTheme ? Colors.white : Colors.black,
icon: const Icon(Icons.support_agent),
tooltip: 'support_agent',
onPressed: () {
@@ -218,6 +196,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
),
IconButton(
icon: const Icon(Icons.public),
color: isDarkTheme ? Colors.white : Colors.black,
tooltip: 'public',
onPressed: () {
if (_serverModel.serverEntityList.isEmpty) {
@@ -228,6 +207,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
},
),
IconButton(
color: isDarkTheme ? Colors.white : Colors.black,
icon: const Icon(Icons.menu),
tooltip: 'menu',
onPressed: () {
@@ -240,173 +220,5 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
],
),
body: HomeWidget());
return Scaffold(
appBar: AppBar(
shadowColor: Colors.transparent,
title: currentPage == 2
? const Text('My Account')
: SvgPicture.asset(
'assets/text2.svg',
height: 28,
color: isDarkTheme ? Colors.white : Colors.black,
),
actions: currentPage == 0 ? null : null),
/*[
Padding(
padding: const EdgeInsets.all(8.0),
child: GestureDetector(
onTap: () => Navigator.of(context).push(
MaterialPageRoute(
builder: (builder) => const ProRoute())),
child: SvgPicture.asset(
'assets/Features.svg',
height: 20,
color: AppColors.greenColor,
),
),
),
]
Here Bottom Navigation Bar with some padding, margin,
little bit color & border decoration*/
bottomNavigationBar: Container(
// margin: const EdgeInsets.only(left: 32, right: 32, bottom: 0),
padding: const EdgeInsets.only(top: 0.0),
decoration: BoxDecoration(
color:
const Color(0xff353351).withOpacity(isDarkTheme ? 0.3 : 0.05),
borderRadius: BorderRadius.circular(0)),
child: BottomNavigationBar(
enableFeedback: true,
backgroundColor: Colors.transparent,
elevation: 0,
showSelectedLabels: true,
showUnselectedLabels: true,
selectedLabelStyle:
TextStyle(color: isDarkTheme ? Colors.white : Colors.black),
selectedItemColor: Theme.of(context).primaryColor,
unselectedItemColor: isDarkTheme ? Colors.white : Colors.black,
currentIndex: currentPage,
onTap: (value) => setState(() {
currentPage = value;
}),
items: List.generate(
_itemsList.length,
(index) => BottomNavigationBarItem(
icon: Icon(_itemsList[index]['icon'] as IconData,
size: 30,
color: index != currentPage
? const Color(0xffB5AEBE)
: Theme.of(context).primaryColor),
/*SvgPicture.asset(
_itemsList[index]['iconPath'] as String,
height: index != currentPage ? 20 : 24,
color: index != currentPage
? const Color(0xffB5AEBE)
: Theme.of(context).primaryColor),
*/
label: _itemsList[index]['name'] as String,
))),
),
body: _itemsList[currentPage]['route'] as Widget);
}
}
/*
Widget buildold(BuildContext context) {
bool isDarkTheme = Provider.of<ThemeCollection>(context).isDarkActive;
ScreenUtil.init(context,
designSize: const Size(AppDimens.maxWidth, AppDimens.maxHeight));
// if (!_isfinishedLoad) {
// return const ProgressView();
// }
return Scaffold(
// appBar: SailAppBar(
// appTitle: _appModel.appTitle,
// ),
extendBody: true,
backgroundColor:
_appModel.isOn ? AppColors.greenColor : AppColors.grayColor,
body: SafeArea(
bottom: false,
child: HomeWidget(),
),
);
return AnnotatedRegion<SystemUiOverlayStyle>(
value: _appModel.isOn
? SystemUiOverlayStyle.dark
: SystemUiOverlayStyle.light,
child: Scaffold(
appBar: SailAppBar(
appTitle: _appModel.appTitle,
),
extendBody: true,
backgroundColor:
_appModel.isOn ? AppColors.greenColor : AppColors.grayColor,
body: SafeArea(
bottom: false,
child: PageView(
physics: const NeverScrollableScrollPhysics(),
controller: _appModel.pageController,
children: const [
HomeWidget(),
PlanPage(),
ServerListPage(),
MyProfile()
],
)),
floatingActionButtonLocation:
FloatingActionButtonLocation.centerDocked,
// floatingActionButton: const PowerButton(),
bottomNavigationBar: ClipRRect(
// borderRadius: BorderRadius.only(
// topLeft: Radius.circular(ScreenUtil().setWidth(50)),
// topRight: Radius.circular(ScreenUtil().setWidth(50))),
child: BottomAppBar(
// notchMargin: 8,
// shape: const CircularNotchedRectangle(),
color:
_appModel.isOn ? AppColors.grayColor : AppColors.themeColor,
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
IconButton(
icon: const Icon(
Icons.home_rounded,
color: Colors.white,
),
onPressed: () => _appModel.jumpToPage(0),
),
IconButton(
icon: const Icon(
Icons.wallet,
color: Colors.white,
),
onPressed: () => _appModel.jumpToPage(1),
),
// SizedBox(
// width: ScreenUtil().setWidth(50),
// ),
IconButton(
icon: const Icon(
Icons.cloud_rounded,
color: Colors.white,
),
onPressed: () => _appModel.jumpToPage(2),
),
IconButton(
icon: const Icon(
Icons.person,
color: Colors.white,
),
onPressed: () => _appModel.jumpToPage(3),
)
],
),
))));
}
}*/
+3 -5
View File
@@ -25,9 +25,7 @@ class HomePagesss extends StatelessWidget {
Builder(builder: (context) {
return RichText(
text: TextSpan(
style: TextStyle(
fontSize: 16,
color: isDarkTheme ? Colors.white : Colors.black),
style: Theme.of(context).primaryTextTheme.labelMedium,
text:
Provider.of<UserPreference>(context).isCountDownStart
? Random().nextInt(500).toString() + ' '
@@ -82,10 +80,10 @@ class HomePagesss extends StatelessWidget {
Flags.list[currentLocIndex]['name'] as String,
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: Theme.of(context).primaryTextTheme.headline6,
style: Theme.of(context).primaryTextTheme.labelMedium,
),
subtitle: Text('IP: 79.110.53.95',
style: Theme.of(context).primaryTextTheme.caption),
style: Theme.of(context).primaryTextTheme.labelMedium),
);
}),
),
+5 -5
View File
@@ -77,7 +77,7 @@ class ProPage extends StatelessWidget {
])),
const SizedBox(height: 32),
/**childAspectRatio: 16 / 10,
/*childAspectRatio: 16 / 10,
crossAxisCount: 2,
mainAxisSpacing: 8,
crossAxisSpacing: 14), */
@@ -159,7 +159,7 @@ class ProPage extends StatelessWidget {
Text(
'Please rest assured to use.',
textAlign: TextAlign.center,
style: Theme.of(context).primaryTextTheme.caption,
style: Theme.of(context).primaryTextTheme.labelMedium,
),
],
),
@@ -186,7 +186,7 @@ class ProPage extends StatelessWidget {
lt,
style: Theme.of(context)
.primaryTextTheme
.headline6!
.labelMedium!
.copyWith(color: Colors.white),
),
if (isDiscount)
@@ -209,14 +209,14 @@ class ProPage extends StatelessWidget {
text: rt_1,
style: Theme.of(context)
.primaryTextTheme
.headline6!
.labelMedium!
.copyWith(color: Colors.white),
children: [
TextSpan(
text: ' $rt_2',
style: Theme.of(context)
.primaryTextTheme
.bodyText1!
.labelMedium!
.copyWith(color: Colors.white),
)
])),
+1 -1
View File
@@ -30,7 +30,7 @@ class ChooseLocationRoute extends StatelessWidget {
),
title: Text(
Flags.list[index]['name'] as String,
style: Theme.of(context).primaryTextTheme.subtitle1,
style: Theme.of(context).primaryTextTheme.labelMedium,
),
trailing: Icon(
Icons.navigate_next_rounded,
+9 -7
View File
@@ -37,12 +37,12 @@ class _SettingsRouteState extends State<SettingsRoute> {
minLeadingWidth: 35,
dense: true,
contentPadding: EdgeInsets.only(left: 24),
title:
Text(title, style: Theme.of(context).primaryTextTheme.subtitle1),
title: Text(title,
style: Theme.of(context).primaryTextTheme.labelMedium),
subtitle: subtitle != null
? Text(
subtitle,
style: Theme.of(context).primaryTextTheme.caption,
style: Theme.of(context).primaryTextTheme.labelMedium,
)
: null,
// leading: sysicon ??
@@ -70,7 +70,7 @@ class _SettingsRouteState extends State<SettingsRoute> {
'Upgrade',
style: Theme.of(context)
.primaryTextTheme
.bodyText1!
.labelMedium!
.copyWith(color: Colors.white),
),
));
@@ -97,7 +97,7 @@ class _SettingsRouteState extends State<SettingsRoute> {
child: Text(title,
style: Theme.of(context)
.primaryTextTheme
.subtitle1!
.labelMedium!
.copyWith(color: Colors.grey)),
),
SwitchListTile(
@@ -109,7 +109,7 @@ class _SettingsRouteState extends State<SettingsRoute> {
contentPadding: EdgeInsets.only(left: 24),
title: Text(
description,
style: Theme.of(context).primaryTextTheme.subtitle1,
style: Theme.of(context).primaryTextTheme.labelMedium,
),
value: value,
onChanged: onChanged)
@@ -121,8 +121,10 @@ class _SettingsRouteState extends State<SettingsRoute> {
bool isDarkTheme = Provider.of<ThemeCollection>(context).isDarkActive;
var themeData = Provider.of<ThemeCollection>(context);
return Scaffold(
backgroundColor: isDarkTheme ? Color(0xff0B0415) : Colors.white,
appBar: AppBar(
shadowColor: Colors.transparent,
backgroundColor: Colors.transparent,
foregroundColor: isDarkTheme ? Colors.white : Color(0xff0B0415),
title: const Text('Settings'),
),
body: ListView(
+3 -25
View File
@@ -42,12 +42,12 @@ class HomeWidgetState extends State<HomeWidget>
onTap: onTap ?? null,
minLeadingWidth: 35,
dense: true,
title:
Text(title, style: Theme.of(context).primaryTextTheme.subtitle1),
title: Text(title,
style: Theme.of(context).primaryTextTheme.labelMedium),
subtitle: subtitle != null
? Text(
subtitle,
style: Theme.of(context).primaryTextTheme.caption,
style: Theme.of(context).primaryTextTheme.labelMedium,
)
: null,
leading: SvgPicture.asset(
@@ -95,18 +95,10 @@ class HomeWidgetState extends State<HomeWidget>
super.build(context);
bool isDarkTheme = Provider.of<ThemeCollection>(context).isDarkActive;
final birthday = DateTime(2023, 06, 12);
//当前日期
final date2 = DateTime.now();
//比较相差的天数
final difference = date2.difference(birthday).inDays;
// print("比较相差的天数DateTime(2023, 06, 12):${difference}");
return SingleChildScrollView(
controller: _controller,
physics: const BouncingScrollPhysics(),
child: Column(
// mainAxisAlignment: MainAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.center,
children: [
// // Logo bar
// Padding(
@@ -136,19 +128,6 @@ class HomeWidgetState extends State<HomeWidget>
const SizedBox(
height: 40,
),
// Padding(
// padding: EdgeInsets.symmetric(horizontal: 75, vertical: 30),
// child: Stack(alignment: Alignment.center, children: [
// // Image.asset(
// // "assets/map.png",
// // scale: 4,
// // color: _appModel.isOn
// // ? const Color(0x15000000)
// // : AppColors.darkSurfaceColor,
// // ),
// const PowerButton(),
// ])),
_appModel.isOn
? (_serverModel.selectServerEntity?.name != null
? Center(
@@ -180,7 +159,6 @@ class HomeWidgetState extends State<HomeWidget>
: const SizedBox(
height: 1,
),
// const SelectLocation(),
const BottomBlock(),
],