Skip to content

Commit 8ad0a23

Browse files
committed
#336: used base screen on screens in the app
1 parent b53fccb commit 8ad0a23

File tree

2 files changed

+82
-104
lines changed

2 files changed

+82
-104
lines changed

lib/screen/login/login_screen.dart

+40-51
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import 'package:flutter_template/di/injectable.dart';
44
import 'package:flutter_template/styles/theme_dimens.dart';
55
import 'package:flutter_template/util/keys.dart';
66
import 'package:flutter_template/viewmodel/login/login_viewmodel.dart';
7-
import 'package:flutter_template/widget/general/status_bar.dart';
7+
import 'package:flutter_template/widget/general/simple_screen/base_screen.dart';
88
import 'package:flutter_template/widget/general/styled/flutter_template_button.dart';
99
import 'package:flutter_template/widget/general/styled/flutter_template_input_field.dart';
1010
import 'package:flutter_template/widget/general/styled/flutter_template_progress_indicator.dart';
@@ -26,57 +26,46 @@ class LoginScreenState extends State<LoginScreen> {
2626
Widget build(BuildContext context) {
2727
return ProviderWidget<LoginViewModel>(
2828
create: () => getIt()..init(),
29-
consumerWithThemeAndLocalization: (context, viewModel, child, theme, localization) => StatusBar.animated(
30-
isDarkStyle: theme.isDarkTheme,
31-
child: Scaffold(
32-
backgroundColor: theme.colorsTheme.background,
33-
body: SafeArea(
34-
child: Container(
35-
width: double.infinity,
36-
padding: const EdgeInsets.all(ThemeDimens.padding16),
37-
child: Column(
38-
children: [
39-
Container(height: ThemeDimens.padding16),
40-
Text(
41-
'Login',
42-
style: theme.coreTextTheme.titleNormal,
43-
textAlign: TextAlign.center,
44-
),
45-
Container(height: ThemeDimens.padding32),
46-
Text(
47-
'Just fill in some text. There is no validator for the login',
48-
style: theme.coreTextTheme.labelButtonSmall,
49-
),
50-
Container(height: ThemeDimens.padding32),
51-
FlutterTemplateInputField(
52-
key: Keys.emailInput,
53-
enabled: !viewModel.isLoading,
54-
onChanged: viewModel.onEmailUpdated,
55-
hint: 'Email',
56-
),
57-
Container(height: ThemeDimens.padding16),
58-
FlutterTemplateInputField(
59-
key: Keys.passwordInput,
60-
enabled: !viewModel.isLoading,
61-
onChanged: viewModel.onPasswordUpdated,
62-
hint: 'Password',
63-
),
64-
Container(height: ThemeDimens.padding16),
65-
if (viewModel.isLoading) ...[
66-
const FlutterTemplateProgressIndicator.light(),
67-
] else ...[
68-
FlutterTemplateButton(
69-
key: Keys.loginButton,
70-
isEnabled: viewModel.isLoginEnabled,
71-
text: 'Login',
72-
onClick: viewModel.onLoginClicked,
73-
),
74-
],
75-
],
76-
),
77-
),
29+
consumerWithThemeAndLocalization: (context, viewModel, child, theme, localization) => BaseScreen(
30+
showHeader: false,
31+
children: [
32+
Container(height: ThemeDimens.padding16),
33+
Text(
34+
'Login',
35+
style: theme.coreTextTheme.titleNormal,
36+
textAlign: TextAlign.center,
37+
),
38+
Container(height: ThemeDimens.padding32),
39+
Text(
40+
'Just fill in some text. There is no validator for the login',
41+
style: theme.coreTextTheme.labelButtonSmall,
42+
),
43+
Container(height: ThemeDimens.padding32),
44+
FlutterTemplateInputField(
45+
key: Keys.emailInput,
46+
enabled: !viewModel.isLoading,
47+
onChanged: viewModel.onEmailUpdated,
48+
hint: 'Email',
7849
),
79-
),
50+
Container(height: ThemeDimens.padding16),
51+
FlutterTemplateInputField(
52+
key: Keys.passwordInput,
53+
enabled: !viewModel.isLoading,
54+
onChanged: viewModel.onPasswordUpdated,
55+
hint: 'Password',
56+
),
57+
Container(height: ThemeDimens.padding16),
58+
if (viewModel.isLoading) ...[
59+
const FlutterTemplateProgressIndicator.light(),
60+
] else ...[
61+
FlutterTemplateButton(
62+
key: Keys.loginButton,
63+
isEnabled: viewModel.isLoginEnabled,
64+
text: 'Login',
65+
onClick: viewModel.onLoginClicked,
66+
),
67+
],
68+
],
8069
),
8170
);
8271
}

lib/screen/permission/analytics_permission_screen.dart

+42-53
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import 'package:flutter/material.dart';
2-
import 'package:flutter/services.dart';
32
import 'package:flutter_navigation_generator_annotations/flutter_navigation_generator_annotations.dart';
43
import 'package:flutter_svg/flutter_svg.dart';
54
import 'package:flutter_template/di/injectable.dart';
65
import 'package:flutter_template/styles/theme_assets.dart';
76
import 'package:flutter_template/viewmodel/permission/analytics_permission_viewmodel.dart';
7+
import 'package:flutter_template/widget/general/simple_screen/base_screen.dart';
88
import 'package:flutter_template/widget/general/styled/flutter_template_button.dart';
99
import 'package:flutter_template/widget/provider/provider_widget.dart';
1010

@@ -16,62 +16,51 @@ class AnalyticsPermissionScreen extends StatelessWidget {
1616
Widget build(BuildContext context) {
1717
return ProviderWidget<AnalyticsPermissionViewModel>(
1818
create: () => getIt()..init(),
19-
childBuilderWithViewModel: (context, viewModel, theme, localization) => AnnotatedRegion<SystemUiOverlayStyle>(
20-
value: theme.isDarkTheme ? SystemUiOverlayStyle.light : SystemUiOverlayStyle.dark,
21-
child: Scaffold(
22-
backgroundColor: theme.colorsTheme.permissionScreenBackground,
23-
body: Padding(
24-
padding: const EdgeInsets.symmetric(
25-
horizontal: 16.0,
26-
vertical: 32,
27-
),
28-
child: Column(
29-
children: [
30-
Expanded(
31-
child: Center(
32-
child: Column(
33-
mainAxisSize: MainAxisSize.min,
34-
children: [
35-
const Spacer(),
36-
Expanded(
37-
flex: 5,
38-
child: SvgPicture.asset(
39-
ThemeAssets.analyticsImage(context),
40-
alignment: Alignment.center,
41-
fit: BoxFit.scaleDown,
42-
),
43-
),
44-
const Spacer(),
45-
const SizedBox(height: 32),
46-
Text(
47-
localization.permissionAnalyticsTitle,
48-
style: theme.coreTextTheme.titleNormal,
49-
),
50-
const SizedBox(height: 16),
51-
Text(
52-
localization.permissionAnalyticsDescription,
53-
textAlign: TextAlign.center,
54-
style: theme.coreTextTheme.bodyNormal,
55-
),
56-
const Spacer(),
57-
],
19+
childBuilderWithViewModel: (context, viewModel, theme, localization) => BaseScreen(
20+
showHeader: false,
21+
children: [
22+
Expanded(
23+
child: Center(
24+
child: Column(
25+
mainAxisSize: MainAxisSize.min,
26+
children: [
27+
const Spacer(),
28+
Expanded(
29+
flex: 5,
30+
child: SvgPicture.asset(
31+
ThemeAssets.analyticsImage(context),
32+
alignment: Alignment.center,
33+
fit: BoxFit.scaleDown,
5834
),
5935
),
60-
),
61-
const SizedBox(height: 8),
62-
FlutterTemplateButton(
63-
text: localization.permissionButtonAccept,
64-
onClick: viewModel.onAcceptClicked,
65-
),
66-
const SizedBox(height: 8),
67-
FlutterTemplateButton.text(
68-
text: localization.permissionButtonMoreInfo,
69-
onClick: viewModel.onMoreInfoClicked,
70-
),
71-
],
36+
const Spacer(),
37+
const SizedBox(height: 32),
38+
Text(
39+
localization.permissionAnalyticsTitle,
40+
style: theme.coreTextTheme.titleNormal,
41+
),
42+
const SizedBox(height: 16),
43+
Text(
44+
localization.permissionAnalyticsDescription,
45+
textAlign: TextAlign.center,
46+
style: theme.coreTextTheme.bodyNormal,
47+
),
48+
const Spacer(),
49+
],
50+
),
7251
),
7352
),
74-
),
53+
const SizedBox(height: 8),
54+
FlutterTemplateButton(
55+
text: localization.permissionButtonAccept,
56+
onClick: viewModel.onAcceptClicked,
57+
),
58+
const SizedBox(height: 8),
59+
FlutterTemplateButton.text(
60+
text: localization.permissionButtonMoreInfo,
61+
onClick: viewModel.onMoreInfoClicked,
62+
),
63+
],
7564
),
7665
);
7766
}

0 commit comments

Comments
 (0)