Skip to content

Commit 73ffb63

Browse files
committed
Add ScreenUtils and update theme definitions
1 parent 0f91102 commit 73ffb63

File tree

13 files changed

+63
-29
lines changed

13 files changed

+63
-29
lines changed

assets/images/svg/logo.svg

Lines changed: 5 additions & 0 deletions
Loading

ios/Flutter/AppFrameworkInfo.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
<key>CFBundleVersion</key>
2222
<string>1.0</string>
2323
<key>MinimumOSVersion</key>
24-
<string>9.0</string>
24+
<string>11.0</string>
2525
</dict>
2626
</plist>

ios/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Uncomment this line to define a global platform for your project
2-
# platform :ios, '9.0'
2+
# platform :ios, '11.0'
33

44
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
55
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

ios/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ EXTERNAL SOURCES:
2929
:path: ".symlinks/plugins/shared_preferences_ios/ios"
3030

3131
SPEC CHECKSUMS:
32-
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
32+
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
3333
flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef
3434
flutter_secure_storage: 7953c38a04c3fdbb00571bcd87d8e3b5ceb9daec
3535
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
3636
shared_preferences_ios: 548a61f8053b9b8a49ac19c1ffbc8b92c50d68ad
3737

38-
PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
38+
PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
3939

4040
COCOAPODS: 1.11.3

ios/Runner.xcodeproj/project.pbxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@
340340
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
341341
GCC_WARN_UNUSED_FUNCTION = YES;
342342
GCC_WARN_UNUSED_VARIABLE = YES;
343-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
343+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
344344
MTL_ENABLE_DEBUG_INFO = NO;
345345
SDKROOT = iphoneos;
346346
SUPPORTED_PLATFORMS = iphoneos;
@@ -418,7 +418,7 @@
418418
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
419419
GCC_WARN_UNUSED_FUNCTION = YES;
420420
GCC_WARN_UNUSED_VARIABLE = YES;
421-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
421+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
422422
MTL_ENABLE_DEBUG_INFO = YES;
423423
ONLY_ACTIVE_ARCH = YES;
424424
SDKROOT = iphoneos;
@@ -467,7 +467,7 @@
467467
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
468468
GCC_WARN_UNUSED_FUNCTION = YES;
469469
GCC_WARN_UNUSED_VARIABLE = YES;
470-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
470+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
471471
MTL_ENABLE_DEBUG_INFO = NO;
472472
SDKROOT = iphoneos;
473473
SUPPORTED_PLATFORMS = iphoneos;

lib/constants/assets.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const basePath = 'assets/images';
2+
3+
const logoSvgFilePath = "$basePath/svg/logo.svg";

lib/main.dart

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter_bloc/flutter_bloc.dart';
33
import 'package:flutter_dotenv/flutter_dotenv.dart';
4+
import 'package:flutter_screenutil/flutter_screenutil.dart';
45
import 'package:flutter_template/constants/l10n/localizations.dart';
56
import 'package:flutter_template/data/repositories/user_repository.dart';
67
import 'package:shared_preferences/shared_preferences.dart';
@@ -54,16 +55,20 @@ class FlutterTemplateApp extends StatelessWidget {
5455
create: (context) =>
5556
LoginCubit(repository: context.read<UserRepository>())),
5657
],
57-
child: MaterialApp(
58-
debugShowCheckedModeBanner: false,
59-
onGenerateRoute: appRouter.onGenerateRoute,
60-
theme: lightTheme,
61-
darkTheme: darkTheme,
62-
themeMode: ThemeMode.light,
63-
localizationsDelegates: localizationDelegates,
64-
supportedLocales: supportedLocales,
65-
locale: currentLanguage,
66-
)),
58+
child: ScreenUtilInit(
59+
designSize: const Size(360, 690),
60+
builder: (BuildContext context, Widget? child) {
61+
return MaterialApp(
62+
debugShowCheckedModeBanner: false,
63+
onGenerateRoute: appRouter.onGenerateRoute,
64+
theme: lightTheme,
65+
darkTheme: darkTheme,
66+
themeMode: ThemeMode.light,
67+
localizationsDelegates: localizationDelegates,
68+
supportedLocales: supportedLocales,
69+
locale: currentLanguage,
70+
);
71+
})),
6772
);
6873
}
6974
}

lib/ui/screens/login/login.dart

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter_bloc/flutter_bloc.dart';
3+
import 'package:flutter_svg/svg.dart';
34
import 'package:flutter_template/bloc/login/login_cubit.dart';
5+
import 'package:flutter_template/constants/assets.dart';
46
import 'package:flutter_template/ui/components/button.dart';
57
import 'package:flutter_template/ui/screens/home/home_navigator.dart';
68
import 'package:flutter_template/ui/themes/text_styles.dart';
79
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
10+
import 'package:flutter_screenutil/flutter_screenutil.dart';
811

912
class LoginWidget extends StatefulWidget {
1013
const LoginWidget({Key? key}) : super(key: key);
@@ -48,6 +51,7 @@ class _LoginWidgetState extends State<LoginWidget> {
4851
@override
4952
Widget build(BuildContext context) {
5053
final locale = AppLocalizations.of(context)!;
54+
final theme = Theme.of(context);
5155

5256
return Scaffold(
5357
appBar: AppBar(title: Text(locale.loginTitle)),
@@ -57,11 +61,15 @@ class _LoginWidgetState extends State<LoginWidget> {
5761
}
5862
}, builder: (context, state) {
5963
return Container(
60-
padding: const EdgeInsets.all(30),
64+
padding: EdgeInsets.all(20.h),
6165
child: Column(
6266
mainAxisAlignment: MainAxisAlignment.spaceBetween,
6367
children: [
64-
const SizedBox(height: 0),
68+
Padding(
69+
padding: EdgeInsets.only(top: 40.h),
70+
child: SvgPicture.asset(logoSvgFilePath,
71+
height: 60.h, width: 60.h, color: theme.primaryColor),
72+
),
6573
Column(children: [
6674
Form(
6775
key: _formKey,

lib/ui/themes/dark_theme.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter_template/ui/themes/text_styles.dart';
33

4+
Color brandingPrimaryColor = const Color(0xff0a0a36);
5+
46
ThemeData darkTheme = ThemeData(
57
brightness: Brightness.dark,
6-
primaryColor: Colors.blueAccent.shade700,
8+
primaryColor: brandingPrimaryColor,
79
primaryColorDark: Colors.blueAccent,
810
primaryColorLight: Colors.lightBlueAccent,
911
disabledColor: Colors.blueGrey,

lib/ui/themes/light_theme.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter_template/ui/themes/text_styles.dart';
33

4+
Color brandingPrimaryColor = const Color(0xff0a0a36);
5+
46
ThemeData lightTheme = ThemeData(
57
brightness: Brightness.light,
6-
primaryColor: Colors.blueAccent.shade700,
8+
primaryColor: brandingPrimaryColor,
79
primaryColorDark: Colors.blueAccent,
810
primaryColorLight: Colors.lightBlueAccent,
911
disabledColor: Colors.blueGrey,

0 commit comments

Comments
 (0)