添加 splash页 部分button

master
张萌 2 years ago
parent 5279ced9c2
commit fb60f29c88

@ -22,6 +22,27 @@ linter:
# `// ignore_for_file: name_of_lint` syntax on the line or in the file # `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint. # producing the lint.
rules: rules:
library_private_types_in_public_api: false
always_use_package_import: true
use_super_parameters: true
use_decorated_box: true
use_colored_box: true
use_full_hex_values_for_flutter_colors: true
use_if_null_to_convert_nulls_to_bools: true
unnecessary_this: true
avoid_type_to_string: true
cancel_subscriptions: true
literal_only_boolean_expressions: true
unnecessary_statements: true
file_names: true
missing_whitespace_between_adjacent_strings: true
no_runtimeType_toString: true
prefer_null_aware_method_calls: true
avoid_positional_boolean_parameters: true
avoid_bool_literals_in_conditional_expressions: true
prefer_function_declarations_over_variables: true
prefer_interpolation_to_compose_strings: true
prefer_null_aware_operators: true
# avoid_print: false # Uncomment to disable the `avoid_print` rule # avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

@ -1,193 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class AppTheme {
static ThemeData get theme {
return ThemeData(primarySwatch: Colors.blue).copyWith(
primaryColor: const Color(0xFF027AFF),
extensions: <ThemeExtension<dynamic>>[
MyAppStyle(
mainColor: Colors.blue,
bodyText3: TextStyle(
fontSize: 30.sp,
color: const Color(0xFF333333),
),
)
],
textTheme: ThemeData.light().textTheme.copyWith(
headline3: TextStyle(
fontSize: 40.sp,
color: const Color(0xFF333333),
fontWeight: FontWeight.bold,
),
headline4: TextStyle(
fontSize: 36.sp,
color: const Color(0xFF111111),
fontWeight: FontWeight.bold,
),
subtitle1: TextStyle(
fontSize: 32.sp,
color: const Color(0xFF333333),
),
subtitle2: TextStyle(
fontSize: 28.sp,
color: const Color(0xFF333333),
),
bodyText1: TextStyle(
fontSize: 24.sp,
color: const Color(0xFF333333),
),
bodyText2: TextStyle(
fontSize: 28.sp,
color: const Color(0xFF333333),
),
),
floatingActionButtonTheme: const FloatingActionButtonThemeData().copyWith(
backgroundColor: const Color(0xFFFFD000),
),
appBarTheme: AppBarTheme(
elevation: 0,
centerTitle: true,
iconTheme: const IconThemeData(
color: Color(0xFF333333),
),
systemOverlayStyle: SystemUiOverlayStyle.dark,
toolbarTextStyle: TextTheme(
headline6: TextStyle(
color: const Color(0xFF333333),
fontSize: 36.sp,
fontWeight: FontWeight.bold,
),
).bodyText2,
titleTextStyle: TextTheme(
headline6: TextStyle(
color: const Color(0xFF333333),
fontSize: 36.sp,
fontWeight: FontWeight.bold,
),
).headline6,
),
tabBarTheme: TabBarTheme(
labelColor: const Color(0xFF333333),
labelStyle: TextStyle(
fontSize: 28.sp,
fontWeight: FontWeight.w600,
),
unselectedLabelStyle: TextStyle(
fontSize: 28.sp,
),
indicatorSize: TabBarIndicatorSize.label,
),
bottomNavigationBarTheme: const BottomNavigationBarThemeData(
selectedItemColor: Color(0xFF333333),
selectedLabelStyle: TextStyle(
fontWeight: FontWeight.bold,
),
type: BottomNavigationBarType.fixed,
unselectedLabelStyle: TextStyle(),
),
radioTheme: RadioThemeData(
fillColor: MaterialStateProperty.resolveWith<Color?>((states) {
if (states.contains(MaterialState.selected)) {
return const Color(0xFFFFD000);
}
return null;
}),
),
elevatedButtonTheme: ElevatedButtonThemeData(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.resolveWith((states) {
if (states.contains(MaterialState.disabled)) {
return const Color(0xFFFFF4D7);
}
return const Color(0xFFFFD000);
}),
elevation: MaterialStateProperty.all(0),
foregroundColor: MaterialStateProperty.resolveWith((states) {
if (states.contains(MaterialState.disabled)) {
return const Color(0xFF666666);
}
return const Color(0xFF333333);
}),
textStyle: MaterialStateProperty.all(TextStyle(
fontSize: 32.sp,
fontWeight: FontWeight.bold,
)),
padding: MaterialStateProperty.all(
EdgeInsets.symmetric(horizontal: 76.w, vertical: 22.w),
),
enableFeedback: true,
),
),
textButtonTheme: TextButtonThemeData(
style: ButtonStyle(
overlayColor: MaterialStateProperty.resolveWith((states) {
if (states.contains(MaterialState.disabled)) {
return const Color(0xFFFFF4D7);
}
return const Color(0xFFFFD000).withOpacity(0.2);
}),
foregroundColor: MaterialStateProperty.resolveWith((states) {
if (states.contains(MaterialState.disabled)) {
return const Color(0xFF666666);
}
return const Color(0xFF333333);
}),
),
),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
dividerColor: const Color(0xFFE8E8E8),
colorScheme: ColorScheme.fromSwatch()
.copyWith(secondary: const Color(0xFF027AFF))
.copyWith(secondary: const Color(0xFF027AFF)),
);
}
}
class SystemStyle {
static const initial = SystemUiOverlayStyle(
statusBarIconBrightness: Brightness.light,
systemNavigationBarColor: Colors.white,
);
static const yellowBottomBar = SystemUiOverlayStyle(
statusBarIconBrightness: Brightness.light,
systemNavigationBarColor: Color(0xFFFFD000),
);
static genStyle({required Color bottom}) {
return SystemUiOverlayStyle(
statusBarIconBrightness: Brightness.light,
systemNavigationBarColor: bottom,
);
}
}
@immutable
class MyAppStyle extends ThemeExtension<MyAppStyle> {
final TextStyle? bodyText3;
final Color? mainColor;
@override
MyAppStyle copyWith({Color? mainColor, TextStyle? bodyText3}) {
return MyAppStyle(
mainColor: mainColor ?? this.mainColor,
bodyText3: bodyText3 ?? this.bodyText3);
}
@override
ThemeExtension<MyAppStyle> lerp(ThemeExtension<MyAppStyle>? other, double t) {
if (other is! MyAppStyle) {
return this;
}
return MyAppStyle(
mainColor: Color.lerp(mainColor, other.mainColor, t),
bodyText3: TextStyle.lerp(bodyText3, other.bodyText3, t),
);
}
const MyAppStyle({
this.bodyText3,
this.mainColor,
});
}

@ -3,46 +3,38 @@ import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
class AppTheme { class AppTheme {
static ThemeData get theme { static ThemeData get defaultTheme {
return ThemeData(primarySwatch: Colors.blue).copyWith( return ThemeData(primarySwatch: Colors.blue).copyWith(
primaryColor: const Color(0xFF027AFF), primaryColor: const Color(0xFF027AFF),
extensions: <ThemeExtension<dynamic>>[ extensions: <ThemeExtension<dynamic>>[MyAppStyle.def()],
MyAppStyle(
mainColor: Colors.blue,
bodyText3: TextStyle(
fontSize: 30.sp,
color: const Color(0xFF333333),
),
)
],
textTheme: ThemeData.light().textTheme.copyWith( textTheme: ThemeData.light().textTheme.copyWith(
headline3: TextStyle( headline3: TextStyle(
fontSize: 40.sp, fontSize: 40.sp,
color: const Color(0xFF333333), color: const Color(0xFF333333),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
headline4: TextStyle( headline4: TextStyle(
fontSize: 36.sp, fontSize: 36.sp,
color: const Color(0xFF111111), color: const Color(0xFF111111),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
subtitle1: TextStyle( subtitle1: TextStyle(
fontSize: 32.sp, fontSize: 32.sp,
color: const Color(0xFF333333), color: const Color(0xFF333333),
), ),
subtitle2: TextStyle( subtitle2: TextStyle(
fontSize: 28.sp, fontSize: 28.sp,
color: const Color(0xFF333333), color: const Color(0xFF333333),
), ),
bodyText1: TextStyle( bodyText1: TextStyle(
fontSize: 24.sp, fontSize: 24.sp,
color: const Color(0xFF333333), color: const Color(0xFF333333),
), ),
bodyText2: TextStyle( bodyText2: TextStyle(
fontSize: 28.sp, fontSize: 28.sp,
color: const Color(0xFF333333), color: const Color(0xFF333333),
), ),
), ),
floatingActionButtonTheme: const FloatingActionButtonThemeData().copyWith( floatingActionButtonTheme: const FloatingActionButtonThemeData().copyWith(
backgroundColor: Colors.blue, backgroundColor: Colors.blue,
), ),
@ -166,13 +158,22 @@ class SystemStyle {
@immutable @immutable
class MyAppStyle extends ThemeExtension<MyAppStyle> { class MyAppStyle extends ThemeExtension<MyAppStyle> {
final TextStyle? bodyText3;
final Color? mainColor; final Color? mainColor;
///
final BoxDecoration? bottomButtonDecoration;
final TextStyle? bottomButtonText;
@override @override
MyAppStyle copyWith({Color? mainColor, TextStyle? bodyText3}) { MyAppStyle copyWith(
{Color? mainColor,
TextStyle? bottomButtonText,
BoxDecoration? bottomButtonDecoration}) {
return MyAppStyle( return MyAppStyle(
mainColor: mainColor ?? this.mainColor, mainColor: mainColor ?? this.mainColor,
bodyText3: bodyText3 ?? this.bodyText3); bottomButtonDecoration:
bottomButtonDecoration ?? this.bottomButtonDecoration,
bottomButtonText: bottomButtonText ?? this.bottomButtonText);
} }
@override @override
@ -182,12 +183,30 @@ class MyAppStyle extends ThemeExtension<MyAppStyle> {
} }
return MyAppStyle( return MyAppStyle(
mainColor: Color.lerp(mainColor, other.mainColor, t), mainColor: Color.lerp(mainColor, other.mainColor, t),
bodyText3: TextStyle.lerp(bodyText3, other.bodyText3, t), bottomButtonDecoration: BoxDecoration.lerp(
bottomButtonDecoration, other.bottomButtonDecoration, t),
bottomButtonText:
TextStyle.lerp(bottomButtonText, other.bottomButtonText, t),
); );
} }
const MyAppStyle({ const MyAppStyle({
this.bodyText3, this.bottomButtonText,
this.mainColor, this.mainColor,
this.bottomButtonDecoration,
}); });
MyAppStyle.def()
: mainColor = Colors.blue,
bottomButtonDecoration =
BoxDecoration(
gradient: const LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [Color(0xFF0593FF), Color(0xFF027AFF)]),
borderRadius: BorderRadius.circular(8.w)),
bottomButtonText = TextStyle(
fontSize: 30.sp,
color: const Color(0xFF333333),
);
} }

@ -1,5 +1,7 @@
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
import 'package:cloud_car_internal/constants/app_theme.dart';
import 'package:cloud_car_internal/providers/user_provider.dart'; import 'package:cloud_car_internal/providers/user_provider.dart';
import 'package:cloud_car_internal/ui/splash/splash.dart';
import 'package:cloud_car_internal/utils/api_client.dart'; import 'package:cloud_car_internal/utils/api_client.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -11,35 +13,34 @@ import 'package:flutter_ume_kit_perf/flutter_ume_kit_perf.dart'; // 性能插件
import 'package:flutter_ume_kit_show_code/flutter_ume_kit_show_code.dart'; // import 'package:flutter_ume_kit_show_code/flutter_ume_kit_show_code.dart'; //
import 'package:flutter_ume_kit_device/flutter_ume_kit_device.dart'; // import 'package:flutter_ume_kit_device/flutter_ume_kit_device.dart'; //
import 'package:flutter_ume_kit_console/flutter_ume_kit_console.dart'; // debugPrint import 'package:flutter_ume_kit_console/flutter_ume_kit_console.dart'; // debugPrint
import 'package:flutter_ume_kit_dio/flutter_ume_kit_dio.dart'; import 'package:flutter_ume_kit_dio/flutter_ume_kit_dio.dart'; // Dio
import 'package:get/get_navigation/src/root/get_material_app.dart'; import 'package:get/get_navigation/src/root/get_material_app.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'constants/api/app_theme.dart'; // Dio
void main() { void main() {
if (kDebugMode) { if (kDebugMode) {
PluginManager.instance // PluginManager.instance //
..register(WidgetInfoInspector()) ..register(const WidgetInfoInspector())
..register(WidgetDetailInspector()) ..register(const WidgetDetailInspector())
..register(ColorSucker()) ..register(const ColorSucker())
..register(AlignRuler()) ..register(AlignRuler())
..register(ColorPicker()) // ..register(const ColorPicker()) //
..register(TouchIndicator()) // ..register(const TouchIndicator()) //
..register(Performance()) ..register(Performance())
..register(ShowCode()) ..register(const ShowCode())
..register(MemoryInfoPage()) ..register(const MemoryInfoPage())
..register(CpuInfoPage()) ..register(CpuInfoPage())
..register(DeviceInfoPanel()) ..register(const DeviceInfoPanel())
..register(Console()) ..register(Console())
..register(DioInspector(dio: apiClient.dio)); ..register(DioInspector(dio: apiClient.dio));
runApp(UMEWidget(child: MyApp(), enable: true)); // runApp(const UMEWidget(enable: true, child: MyApp())); //
} else { } else {
runApp(MyApp()); runApp(const MyApp());
} }
} }
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key); const MyApp({super.key});
// This widget is the root of your application. // This widget is the root of your application.
@override @override
@ -63,8 +64,8 @@ class MyApp extends StatelessWidget {
child: GetMaterialApp( child: GetMaterialApp(
onGenerateTitle: (context) => '云云问车', onGenerateTitle: (context) => '云云问车',
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
theme: AppTheme.theme, theme: AppTheme.defaultTheme,
home: MyHomePage(title: ''), home: const SplashPage(),
supportedLocales: const [Locale('zh')], supportedLocales: const [Locale('zh')],
locale: const Locale('zh'), locale: const Locale('zh'),
localizationsDelegates: GlobalMaterialLocalizations.delegates, localizationsDelegates: GlobalMaterialLocalizations.delegates,
@ -84,88 +85,3 @@ class MyApp extends StatelessWidget {
); );
} }
} }
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.
// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
// This call to setState tells the Flutter framework that something has
// changed in this State, which causes it to rerun the build method below
// so that the display can reflect the updated values. If we changed
// _counter without calling setState(), then the build method would not be
// called again, and so nothing would appear to happen.
_counter++;
});
}
@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
return Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: Center(
// Center is a layout widget. It takes a single child and positions it
// in the middle of the parent.
child: Column(
// Column is also a layout widget. It takes a list of children and
// arranges them vertically. By default, it sizes itself to fit its
// children horizontally, and tries to be as tall as its parent.
//
// Invoke "debug painting" (press "p" in the console, choose the
// "Toggle Debug Paint" action from the Flutter Inspector in Android
// Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
// to see the wireframe for each widget.
//
// Column has various properties to control how it sizes itself and
// how it positions its children. Here we use mainAxisAlignment to
// center the children vertically; the main axis here is the vertical
// axis because Columns are vertical (the cross axis would be
// horizontal).
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headline4,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}

@ -17,6 +17,8 @@ class BaseListModel {
factory BaseListModel.fromJson(Map<String, dynamic> json) => factory BaseListModel.fromJson(Map<String, dynamic> json) =>
_$BaseListModelFromJson(json); _$BaseListModelFromJson(json);
Map<String, dynamic> toJson() => _$BaseListModelToJson(this);
List get nullSafetyList { List get nullSafetyList {
if (data == null) { if (data == null) {
return []; return [];
@ -48,4 +50,6 @@ class ListInnerModel {
factory ListInnerModel.fromJson(Map<String, dynamic> json) => factory ListInnerModel.fromJson(Map<String, dynamic> json) =>
_$ListInnerModelFromJson(json); _$ListInnerModelFromJson(json);
Map<String, dynamic> toJson() => _$ListInnerModelToJson(this);
} }

@ -31,6 +31,8 @@ class BaseModel<T> {
msg: err.message, msg: err.message,
); );
Map<String, dynamic> toJson() => _$BaseModelToJson(this);
factory BaseModel.fromJson(Map<String, dynamic> json) => factory BaseModel.fromJson(Map<String, dynamic> json) =>
_$BaseModelFromJson(json) as BaseModel<T>; _$BaseModelFromJson(json) as BaseModel<T>;
} }

@ -3,10 +3,6 @@ import 'package:cloud_car_internal/utils/api_client.dart';
import 'package:cloud_car_internal/utils/hive_util.dart'; import 'package:cloud_car_internal/utils/hive_util.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hive/hive.dart';
import '../constants/api/api.dart';
import '../utils/toast/cloud_toast.dart';
class UserProvider extends ChangeNotifier { class UserProvider extends ChangeNotifier {
bool _isLogin = false; bool _isLogin = false;
@ -30,8 +26,10 @@ class UserProvider extends ChangeNotifier {
} }
} }
Future setToken(String token, ) async { Future setToken(
var appBox = await HiveUtil().openAppBox; String token,
) async {
var appBox = await HiveUtil().openAppBox;
apiClient.setToken(token); apiClient.setToken(token);
await appBox.put('token', token); await appBox.put('token', token);
_isLogin = true; _isLogin = true;

@ -0,0 +1,15 @@
import 'package:flutter/material.dart';
class LoginPage extends StatefulWidget {
const LoginPage({super.key});
@override
_LoginPageState createState() => _LoginPageState();
}
class _LoginPageState extends State<LoginPage> {
@override
Widget build(BuildContext context) {
return Container();
}
}

@ -0,0 +1,117 @@
import 'package:cloud_car_internal/ui/login/login_page.dart';
import 'package:cloud_car_internal/ui/tab_navigator.dart';
import 'package:cloud_car_internal/utils/hive_util.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
import '../../constants/environment/environment.dart';
import '../../providers/user_provider.dart';
class SplashPage extends StatefulWidget {
const SplashPage({super.key});
@override
_SplashPageState createState() => _SplashPageState();
}
class _SplashPageState extends State<SplashPage> {
final TapGestureRecognizer _agreementRecognizer = TapGestureRecognizer();
final TapGestureRecognizer _privacyRecognizer = TapGestureRecognizer();
Future initialAll() async {
///
await HiveUtil.init();
// var agreement = await HiveStore.appBox?.get('agreement') ?? false;
// if (!agreement) {
// var result = await _showLoginVerify();
// if (result == null || !result) {
// await SystemNavigator.pop();
// await HiveStore.appBox?.put('agreement', false);
// } else {
// await HiveStore.appBox?.put('agreement', true);
// }
// }
///Providers
}
Future<bool?> _showLoginVerify() async {
return await showCupertinoDialog(
barrierDismissible: false,
context: context,
builder: (context) {
return CupertinoAlertDialog(
title: const Text('隐私政策和用户协议'),
content: RichText(
text: TextSpan(
text: '点击登录即表示您已阅读并同意',
style: const TextStyle(color: Colors.black),
children: [
TextSpan(
text: '《用户协议》',
style: const TextStyle(color: Colors.blue),
recognizer: _agreementRecognizer
..onTap = () {
// Get.to(() => AgreementPage());
}),
TextSpan(
text: '《隐私政策》',
style: const TextStyle(color: Colors.blue),
recognizer: _privacyRecognizer
..onTap = () {
// Get.to(() => PrivacyPage());
}),
const TextSpan(
style: TextStyle(color: Colors.black),
text:
'(特别是免除或限制责任、管辖等粗体下划线标注的条款)。如您不同意上述协议的任何条款,您应立即停止登录及使用本软件及服务。')
]),
),
// ),
actions: [
CupertinoDialogAction(
onPressed: () => Get.back(result: true),
child: const Text('同意'),
),
CupertinoDialogAction(
onPressed: () => Get.back(result: false),
child: const Text('拒绝'),
),
],
);
},
);
}
@override
void initState() {
super.initState();
final userProvider = Provider.of<UserProvider>(context, listen: false);
var env = const String.fromEnvironment('ENV', defaultValue: 'dev');
if (kDebugMode) {
print('env :$env');
}
DevEV.instance.setEnvironment( context, environment: env == 'dev',);
Future.delayed(const Duration(milliseconds: 1000), () async {
await initialAll();
if (!await userProvider.init()) {
await Get.offAll(() => const LoginPage());
} else {
await Get.offAll(() => const TabNavigator());
}
});
}
@override
Widget build(BuildContext context) {
return const Scaffold(
body: Center(
child: CircularProgressIndicator(),
),
);
}
}

@ -0,0 +1,15 @@
import 'package:flutter/material.dart';
class TabNavigator extends StatefulWidget {
const TabNavigator({super.key});
@override
_TabNavigatorState createState() => _TabNavigatorState();
}
class _TabNavigatorState extends State<TabNavigator> {
@override
Widget build(BuildContext context) {
return Container();
}
}

@ -3,7 +3,7 @@ import 'package:hive/hive.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
class HiveUtil { class HiveUtil {
static late final HiveUtil _instance = HiveUtil._(); static final HiveUtil _instance = HiveUtil._();
factory HiveUtil() => _instance; factory HiveUtil() => _instance;

@ -1,9 +1,9 @@
import 'package:cloud_car_internal/constants/api/app_theme.dart'; import 'package:cloud_car_internal/constants/app_theme.dart';
import 'package:cloud_car_internal/providers/user_provider.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../providers/user_provider.dart';
class UserTool { class UserTool {
static UserProvider userProvider = static UserProvider userProvider =

@ -0,0 +1,32 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
class CloudBackButton extends StatelessWidget {
final Color color;
final bool isSpecial;
const CloudBackButton({
super.key,
this.color = const Color(0xFF111111),
this.isSpecial = false,
});
@override
Widget build(BuildContext context) {
return Navigator.canPop(context)
? Padding(
padding: isSpecial ? EdgeInsets.only(left: 8.w) : EdgeInsets.zero,
child: IconButton(
onPressed: () => Get.back(),
icon: Icon(
CupertinoIcons.chevron_back,
color: color,
),
),
)
: const SizedBox();
}
}

@ -0,0 +1,39 @@
import 'package:cloud_car_internal/utils/user_tool.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class CloudBottomButton extends StatefulWidget {
final String text;
final BoxDecoration? decoration;
final Function() onTap;
const CloudBottomButton({
super.key,
this.text = '返回首页',
required this.onTap, this.decoration,
});
@override
State<CloudBottomButton> createState() => _CloudBottomButtonState();
}
class _CloudBottomButtonState extends State<CloudBottomButton> {
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap:widget.onTap,
child: Material(
color:Colors.transparent,
child: Container(
alignment: Alignment.center,
padding: EdgeInsets.symmetric(vertical: 15.w),
margin: EdgeInsets.symmetric(horizontal: 32.w),
decoration:widget.decoration?? UserTool.myAppStyle.bottomButtonDecoration!,
child: Text(
widget.text,
style: UserTool.myAppStyle.bottomButtonText,
),
),
),
);
}
}

@ -0,0 +1,75 @@
import 'package:cloud_car_internal/constants/app_theme.dart';
import 'package:cloud_car_internal/widget/buttons/cloud_back_button.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class CloudScaffold extends StatelessWidget {
final Widget? body;
final Widget? appbar;
final Color bodyColor;
final Widget? bottomNavi;
final FloatingActionButton? fab;
final bool extendBody;
final String? path;
final SystemUiOverlayStyle systemStyle;
final String? title;
final List<Widget> actions;
final Color? appBarBackColor;
final PreferredSizeWidget? appBarBottom;
final Widget? endDrawer;
const CloudScaffold(
{super.key,
this.body,
this.appbar,
this.bodyColor = const Color(0xFFF9F9F9),
this.bottomNavi,
this.fab,
this.systemStyle = SystemStyle.initial,
this.extendBody = false,
this.path,
this.title,
this.appBarBackColor = Colors.white,
this.appBarBottom,
this.actions = const [],
this.endDrawer})
: assert(title != null || appbar != null);
@override
Widget build(BuildContext context) {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.light);
return AnnotatedRegion<SystemUiOverlayStyle>(
value: systemStyle,
child: Scaffold(
endDrawer: endDrawer,
backgroundColor: bodyColor,
extendBodyBehindAppBar: extendBody,
extendBody: extendBody,
body: body,
appBar: PreferredSize(
preferredSize: Size.fromHeight(176.w),
child: title == null
? appbar!
: AppBar(
bottom: appBarBottom,
backgroundColor:
extendBody ? Colors.transparent : appBarBackColor,
leading: const CloudBackButton(),
title: Text(
title!,
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 32.sp),
),
actions: actions,
),
),
bottomNavigationBar: bottomNavi,
floatingActionButton: fab,
),
);
}
}

@ -360,49 +360,49 @@ packages:
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_ume: flutter_ume:
dependency: "direct dev" dependency: "direct main"
description: description:
name: flutter_ume name: flutter_ume
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.3.0+1" version: "0.3.0+1"
flutter_ume_kit_console: flutter_ume_kit_console:
dependency: "direct dev" dependency: "direct main"
description: description:
name: flutter_ume_kit_console name: flutter_ume_kit_console
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.3.0" version: "0.3.0"
flutter_ume_kit_device: flutter_ume_kit_device:
dependency: "direct dev" dependency: "direct main"
description: description:
name: flutter_ume_kit_device name: flutter_ume_kit_device
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.3.0" version: "0.3.0"
flutter_ume_kit_dio: flutter_ume_kit_dio:
dependency: "direct dev" dependency: "direct main"
description: description:
name: flutter_ume_kit_dio name: flutter_ume_kit_dio
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.3.0" version: "0.3.0"
flutter_ume_kit_perf: flutter_ume_kit_perf:
dependency: "direct dev" dependency: "direct main"
description: description:
name: flutter_ume_kit_perf name: flutter_ume_kit_perf
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.3.0" version: "0.3.0"
flutter_ume_kit_show_code: flutter_ume_kit_show_code:
dependency: "direct dev" dependency: "direct main"
description: description:
name: flutter_ume_kit_show_code name: flutter_ume_kit_show_code
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.3.0" version: "0.3.0"
flutter_ume_kit_ui: flutter_ume_kit_ui:
dependency: "direct dev" dependency: "direct main"
description: description:
path: "kits/flutter_ume_kit_ui" path: "kits/flutter_ume_kit_ui"
ref: HEAD ref: HEAD

@ -47,12 +47,6 @@ dependencies:
equatable: ^2.0.3 equatable: ^2.0.3
#工具类 #工具类
common_utils: ^2.1.0 common_utils: ^2.1.0
cupertino_icons: ^1.0.2
dev_dependencies:
flutter_test:
sdk: flutter
#应用内调试工具 #应用内调试工具
flutter_ume: ^0.3.0+1 flutter_ume: ^0.3.0+1
flutter_ume_kit_ui: flutter_ume_kit_ui:
@ -64,6 +58,12 @@ dev_dependencies:
flutter_ume_kit_show_code: ^0.3.0 flutter_ume_kit_show_code: ^0.3.0
flutter_ume_kit_console: ^0.3.0 flutter_ume_kit_console: ^0.3.0
flutter_ume_kit_dio: ^0.3.0 flutter_ume_kit_dio: ^0.3.0
cupertino_icons: ^1.0.2
dev_dependencies:
flutter_test:
sdk: flutter
#导入包整理 #导入包整理
import_sorter: ^4.5.1 import_sorter: ^4.5.1
hive_generator: ^1.1.0 hive_generator: ^1.1.0

Loading…
Cancel
Save