Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/#336 base screen #351

Open
wants to merge 6 commits into
base: feature/#349-add-remote-config
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/repository/secure_storage/secure_storage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ abstract class SecureStorage implements SimpleKeyValueStorage {
class _SecureStorage implements SecureStorage {
final FlutterSecureStorage _storage;

final iOSOptions = const IOSOptions(accessibility: KeychainAccessibility.first_unlock);
final iOSOptions = const IOSOptions(accessibility: KeychainAccessibility.unlocked);

_SecureStorage(this._storage);

Expand Down
131 changes: 63 additions & 68 deletions lib/screen/debug/debug_screen.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_navigation_generator_annotations/flutter_navigation_generator_annotations.dart';
import 'package:flutter_template/di/injectable.dart';
import 'package:flutter_template/util/keys.dart';
Expand All @@ -8,6 +7,7 @@ import 'package:flutter_template/viewmodel/global/global_viewmodel.dart';
import 'package:flutter_template/widget/debug/debug_row_item.dart';
import 'package:flutter_template/widget/debug/debug_row_title.dart';
import 'package:flutter_template/widget/debug/debug_switch_row_item.dart';
import 'package:flutter_template/widget/general/simple_screen/base_screen.dart';
import 'package:flutter_template/widget/provider/provider_widget.dart';
import 'package:provider/provider.dart';

Expand All @@ -25,73 +25,68 @@ class DebugScreenState extends State<DebugScreen> {
Widget build(BuildContext context) {
return ProviderWidget<DebugViewModel>(
create: () => getIt()..init(),
consumerWithThemeAndLocalization: (context, viewModel, child, theme, localization) => Scaffold(
backgroundColor: theme.colorsTheme.background,
appBar: AppBar(
systemOverlayStyle: SystemUiOverlayStyle.light,
title: Text(localization.settingsTitle),
backgroundColor: theme.colorsTheme.primary,
),
body: ListView(
children: [
DebugRowTitle(title: localization.debugAnimationsTitle),
DebugRowSwitchItem(
key: Keys.debugSlowAnimations,
title: localization.debugSlowAnimations,
value: viewModel.slowAnimationsEnabled,
onChanged: viewModel.onSlowAnimationsChanged,
),
DebugRowTitle(title: localization.debugThemeTitle),
DebugRowItem(
key: Keys.debugTargetPlatform,
title: localization.debugTargetPlatformTitle,
subTitle: localization.debugTargetPlatformSubtitle(localization.getTranslation(Provider.of<GlobalViewModel>(context).getCurrentPlatform())),
onClick: viewModel.onTargetPlatformClicked,
),
DebugRowItem(
key: Keys.debugThemeMode,
title: localization.debugThemeModeTitle,
subTitle: localization.debugThemeModeSubtitle,
onClick: viewModel.onThemeModeClicked,
),
DebugRowTitle(title: localization.debugLocaleTitle),
DebugRowItem(
key: Keys.debugSelectLanguage,
title: localization.debugLocaleSelector,
subTitle: localization.debugLocaleCurrentLanguage(Provider.of<GlobalViewModel>(context).getCurrentLanguage()),
onClick: viewModel.onSelectLanguageClicked,
),
DebugRowSwitchItem(
key: Keys.debugShowTranslations,
title: localization.debugShowTranslations,
value: Provider.of<GlobalViewModel>(context, listen: false).showsTranslationKeys,
onChanged: (_) => Provider.of<GlobalViewModel>(context, listen: false).toggleTranslationKeys(),
),
DebugRowTitle(title: localization.debugLicensesTitle),
DebugRowItem(
key: Keys.debugLicense,
title: localization.debugLicensesGoTo,
onClick: viewModel.onLicensesClicked,
),
DebugRowTitle(title: localization.debugDatabase),
DebugRowItem(
key: Keys.debugDatabase,
title: localization.debugViewDatabase,
onClick: viewModel.goToDatabase,
),
DebugRowTitle(title: localization.debugPermissionsTitle),
DebugRowItem(
key: Keys.debugPermissionAnalytics,
title: localization.debugPermissionsShowAnalyticsPermission,
onClick: viewModel.goToAnalyticsPermissionScreen,
),
DebugRowItem(
key: Keys.debugPermissionAnalyticsReset,
title: localization.debugPermissionResetAnalytics,
onClick: viewModel.resetAnalyticsPermission,
),
],
),
consumerWithThemeAndLocalization: (context, viewModel, child, theme, localization) => BaseScreen(
title: localization.settingsTitle,
padding: EdgeInsets.zero,
isScrollable: true,
children: [
DebugRowTitle(title: localization.debugAnimationsTitle),
DebugRowSwitchItem(
key: Keys.debugSlowAnimations,
title: localization.debugSlowAnimations,
value: viewModel.slowAnimationsEnabled,
onChanged: viewModel.onSlowAnimationsChanged,
),
DebugRowTitle(title: localization.debugThemeTitle),
DebugRowItem(
key: Keys.debugTargetPlatform,
title: localization.debugTargetPlatformTitle,
subTitle: localization.debugTargetPlatformSubtitle(localization.getTranslation(Provider.of<GlobalViewModel>(context).getCurrentPlatform())),
onClick: viewModel.onTargetPlatformClicked,
),
DebugRowItem(
key: Keys.debugThemeMode,
title: localization.debugThemeModeTitle,
subTitle: localization.debugThemeModeSubtitle,
onClick: viewModel.onThemeModeClicked,
),
DebugRowTitle(title: localization.debugLocaleTitle),
DebugRowItem(
key: Keys.debugSelectLanguage,
title: localization.debugLocaleSelector,
subTitle: localization.debugLocaleCurrentLanguage(Provider.of<GlobalViewModel>(context).getCurrentLanguage()),
onClick: viewModel.onSelectLanguageClicked,
),
DebugRowSwitchItem(
key: Keys.debugShowTranslations,
title: localization.debugShowTranslations,
value: Provider.of<GlobalViewModel>(context, listen: false).showsTranslationKeys,
onChanged: (_) => Provider.of<GlobalViewModel>(context, listen: false).toggleTranslationKeys(),
),
DebugRowTitle(title: localization.debugLicensesTitle),
DebugRowItem(
key: Keys.debugLicense,
title: localization.debugLicensesGoTo,
onClick: viewModel.onLicensesClicked,
),
DebugRowTitle(title: localization.debugDatabase),
DebugRowItem(
key: Keys.debugDatabase,
title: localization.debugViewDatabase,
onClick: viewModel.goToDatabase,
),
DebugRowTitle(title: localization.debugPermissionsTitle),
DebugRowItem(
key: Keys.debugPermissionAnalytics,
title: localization.debugPermissionsShowAnalyticsPermission,
onClick: viewModel.goToAnalyticsPermissionScreen,
),
DebugRowItem(
key: Keys.debugPermissionAnalyticsReset,
title: localization.debugPermissionResetAnalytics,
onClick: viewModel.resetAnalyticsPermission,
),
],
),
);
}
Expand Down
63 changes: 26 additions & 37 deletions lib/screen/license/license_screen.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_navigation_generator_annotations/flutter_navigation_generator_annotations.dart';
import 'package:flutter_template/di/injectable.dart';
import 'package:flutter_template/styles/theme_dimens.dart';
import 'package:flutter_template/viewmodel/license/license_viewmodel.dart';
import 'package:flutter_template/widget/general/styled/flutter_template_back_button.dart';
import 'package:flutter_template/widget/general/simple_screen/base_screen.dart';
import 'package:flutter_template/widget/provider/provider_widget.dart';

@flutterRoute
Expand All @@ -21,41 +19,32 @@ class LicenseScreenState extends State<LicenseScreen> {
Widget build(BuildContext context) {
return ProviderWidget<LicenseViewModel>(
create: getIt.call,
consumerWithThemeAndLocalization: (context, viewModel, child, theme, localization) => Scaffold(
backgroundColor: theme.colorsTheme.background,
appBar: AppBar(
systemOverlayStyle: SystemUiOverlayStyle.light,
leading: FlutterTemplateBackButton.light(onClick: viewModel.onBackClicked),
title: Text(localization.debugLicensesTitle),
backgroundColor: theme.colorsTheme.primary,
),
body: ListView.builder(
padding: const EdgeInsets.all(ThemeDimens.padding16),
itemCount: viewModel.licenses.length,
itemBuilder: (context, index) {
final item = viewModel.licenses[index];
return Card(
color: theme.colorsTheme.background,
child: Padding(
padding: const EdgeInsets.all(ThemeDimens.padding16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
item.name,
style: theme.coreTextTheme.titleNormal,
),
Container(height: ThemeDimens.padding8),
Text(
item.license,
style: theme.coreTextTheme.bodySmall,
),
],
),
consumerWithThemeAndLocalization: (context, viewModel, child, theme, localization) => BaseScreen.builder(
title: localization.debugLicensesTitle,
itemCount: viewModel.licenses.length,
itemBuilder: (context, index) {
final item = viewModel.licenses[index];
return Card(
color: theme.colorsTheme.background,
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
item.name,
style: theme.coreTextTheme.titleNormal,
),
Container(height: 8),
Text(
item.license,
style: theme.coreTextTheme.bodySmall,
),
],
),
);
},
),
),
);
},
),
);
}
Expand Down
92 changes: 40 additions & 52 deletions lib/screen/login/login_screen.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter_navigation_generator_annotations/flutter_navigation_generator_annotations.dart';
import 'package:flutter_template/di/injectable.dart';
import 'package:flutter_template/styles/theme_dimens.dart';
import 'package:flutter_template/util/keys.dart';
import 'package:flutter_template/viewmodel/login/login_viewmodel.dart';
import 'package:flutter_template/widget/general/status_bar.dart';
import 'package:flutter_template/widget/general/simple_screen/base_screen.dart';
import 'package:flutter_template/widget/general/styled/flutter_template_button.dart';
import 'package:flutter_template/widget/general/styled/flutter_template_input_field.dart';
import 'package:flutter_template/widget/general/styled/flutter_template_progress_indicator.dart';
Expand All @@ -26,57 +25,46 @@ class LoginScreenState extends State<LoginScreen> {
Widget build(BuildContext context) {
return ProviderWidget<LoginViewModel>(
create: () => getIt()..init(),
consumerWithThemeAndLocalization: (context, viewModel, child, theme, localization) => StatusBar.animated(
isDarkStyle: theme.isDarkTheme,
child: Scaffold(
backgroundColor: theme.colorsTheme.background,
body: SafeArea(
child: Container(
width: double.infinity,
padding: const EdgeInsets.all(ThemeDimens.padding16),
child: Column(
children: [
Container(height: ThemeDimens.padding16),
Text(
'Login',
style: theme.coreTextTheme.titleNormal,
textAlign: TextAlign.center,
),
Container(height: ThemeDimens.padding32),
Text(
'Just fill in some text. There is no validator for the login',
style: theme.coreTextTheme.labelButtonSmall,
),
Container(height: ThemeDimens.padding32),
FlutterTemplateInputField(
key: Keys.emailInput,
enabled: !viewModel.isLoading,
onChanged: viewModel.onEmailUpdated,
hint: 'Email',
),
Container(height: ThemeDimens.padding16),
FlutterTemplateInputField(
key: Keys.passwordInput,
enabled: !viewModel.isLoading,
onChanged: viewModel.onPasswordUpdated,
hint: 'Password',
),
Container(height: ThemeDimens.padding16),
if (viewModel.isLoading) ...[
const FlutterTemplateProgressIndicator.light(),
] else ...[
FlutterTemplateButton(
key: Keys.loginButton,
isEnabled: viewModel.isLoginEnabled,
text: 'Login',
onClick: viewModel.onLoginClicked,
),
],
],
),
),
consumerWithThemeAndLocalization: (context, viewModel, child, theme, localization) => BaseScreen(
showHeader: false,
children: [
Container(height: 16),
Text(
'Login',
style: theme.coreTextTheme.titleNormal,
textAlign: TextAlign.center,
),
Container(height: 32),
Text(
'Just fill in some text. There is no validator for the login',
style: theme.coreTextTheme.labelButtonSmall,
),
Container(height: 32),
FlutterTemplateInputField(
key: Keys.emailInput,
enabled: !viewModel.isLoading,
onChanged: viewModel.onEmailUpdated,
hint: 'Email',
),
),
Container(height: 16),
FlutterTemplateInputField(
key: Keys.passwordInput,
enabled: !viewModel.isLoading,
onChanged: viewModel.onPasswordUpdated,
hint: 'Password',
),
Container(height: 16),
if (viewModel.isLoading) ...[
const FlutterTemplateProgressIndicator.light(),
] else ...[
FlutterTemplateButton(
key: Keys.loginButton,
isEnabled: viewModel.isLoginEnabled,
text: 'Login',
onClick: viewModel.onLoginClicked,
),
],
],
),
);
}
Expand Down
Loading