diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 5fa99b90..aea5d0e6 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -93,5 +93,7 @@ io.flutter.embedded_views_preview + CADisableMinimumFrameDurationOnPhone + diff --git a/lib/constants/app_theme.dart b/lib/constants/app_theme.dart index 1866ab88..2871d246 100644 --- a/lib/constants/app_theme.dart +++ b/lib/constants/app_theme.dart @@ -6,6 +6,15 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; class AppTheme { static ThemeData get theme { return ThemeData(primarySwatch: Colors.blue).copyWith( + extensions: >[ + MyAppStyle( + mainColor: Colors.blue, + bodyText3: TextStyle( + fontSize: 30.sp, + color: const Color(0xFF333333), + ), + ) + ], progressIndicatorTheme: ProgressIndicatorThemeData(color: Color(0xFFFFD000)), primaryColor: Color(0xFFFFD000), @@ -175,3 +184,32 @@ class SystemStyle { ); } } + +@immutable +class MyAppStyle extends ThemeExtension { + 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 lerp(ThemeExtension? 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, + }); +} diff --git a/lib/widget/others/user_tool.dart b/lib/widget/others/user_tool.dart index 9a410530..bfc561af 100644 --- a/lib/widget/others/user_tool.dart +++ b/lib/widget/others/user_tool.dart @@ -1,3 +1,5 @@ +import 'package:aku_new_community/constants/app_theme.dart'; +import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:provider/provider.dart'; @@ -11,7 +13,12 @@ class UserTool { static AppProvider get appProvider => Provider.of(Get.context!, listen: false); + static DataProvider get dataProvider => Provider.of(Get.context!, listen: false); + + static MyAppStyle get myAppStyle => + Theme.of(Get.context!).extension()!; + UserTool(); }