diff --git a/.github/workflows/melos_bootstrap.yaml b/.github/workflows/melos_bootstrap.yaml index be9dd306..2510fcb1 100644 --- a/.github/workflows/melos_bootstrap.yaml +++ b/.github/workflows/melos_bootstrap.yaml @@ -9,6 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 # v2.16.0 with: channel: "stable" diff --git a/packages/at_onboarding_flutter/example/lib/main.dart b/packages/at_onboarding_flutter/example/lib/main.dart index a3cbe89b..2da782d8 100644 --- a/packages/at_onboarding_flutter/example/lib/main.dart +++ b/packages/at_onboarding_flutter/example/lib/main.dart @@ -1,11 +1,11 @@ import 'dart:async'; + +import 'package:at_app_flutter/at_app_flutter.dart' show AtEnv; +import 'package:at_onboarding_flutter/at_onboarding_flutter.dart'; import 'package:at_onboarding_flutter_example/switch_atsign.dart'; import 'package:flutter/material.dart'; -import 'package:at_onboarding_flutter/at_onboarding_flutter.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; -import 'package:path_provider/path_provider.dart' - show getApplicationSupportDirectory; -import 'package:at_app_flutter/at_app_flutter.dart' show AtEnv; +import 'package:path_provider/path_provider.dart' show getApplicationSupportDirectory; Future main() async { await AtEnv.load(); @@ -22,8 +22,7 @@ Future loadAtClientPreference() async { ..isLocalStoreRequired = true; } -final StreamController updateThemeMode = - StreamController.broadcast(); +final StreamController updateThemeMode = StreamController.broadcast(); class MyApp extends StatefulWidget { const MyApp({Key? key}) : super(key: key); @@ -52,16 +51,14 @@ class MyAppState extends State { brightness: Brightness.light, primaryColor: const Color(0xFFf4533d), scaffoldBackgroundColor: Colors.white, - colorScheme: ThemeData.light().colorScheme.copyWith( - primary: const Color(0xFFf4533d), surface: Colors.white), + colorScheme: + ThemeData.light().colorScheme.copyWith(primary: const Color(0xFFf4533d), surface: Colors.white), ), darkTheme: ThemeData().copyWith( brightness: Brightness.dark, primaryColor: Colors.blue, scaffoldBackgroundColor: Colors.grey[850], - colorScheme: ThemeData.dark() - .colorScheme - .copyWith(primary: Colors.blue, surface: Colors.grey[850]), + colorScheme: ThemeData.dark().colorScheme.copyWith(primary: Colors.blue, surface: Colors.grey[850]), ), locale: _currentLocale, localizationsDelegates: const [ @@ -81,9 +78,7 @@ class MyAppState extends State { actions: [ IconButton( onPressed: () { - updateThemeMode.sink.add(themeMode == ThemeMode.light - ? ThemeMode.dark - : ThemeMode.light); + updateThemeMode.sink.add(themeMode == ThemeMode.light ? ThemeMode.dark : ThemeMode.light); }, icon: Icon( Theme.of(context).brightness == Brightness.light @@ -114,7 +109,15 @@ class MyAppState extends State { rootEnvironment: AtEnv.rootEnvironment, appAPIKey: AtEnv.appApiKey, theme: AtOnboardingTheme( - primaryColor: null, + primaryColor: Colors.blue, + textTheme: const TextTheme( + titleMedium: TextStyle( + fontSize: 16, + color: Colors.black, + fontWeight: FontWeight.w600, + ), + // ), + ), ), showPopupSharedStorage: true, ), @@ -123,10 +126,7 @@ class MyAppState extends State { switch (result?.status) { case AtOnboardingResultStatus.success: - Navigator.push( - context, - MaterialPageRoute( - builder: (_) => const HomeScreen())); + Navigator.push(context, MaterialPageRoute(builder: (_) => const HomeScreen())); break; case null: case AtOnboardingResultStatus.error: @@ -156,6 +156,15 @@ class MyAppState extends State { domain: AtEnv.rootDomain, rootEnvironment: AtEnv.rootEnvironment, appAPIKey: AtEnv.appApiKey, + theme: AtOnboardingTheme( + primaryColor: Colors.blue, + textTheme: const TextTheme( + titleMedium: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + ), + ), + ), ), ); } @@ -171,17 +180,13 @@ class MyAppState extends State { DropdownButton( onChanged: (value) { setState(() { - value == 'en' - ? _currentLocale = const Locale('en') - : _currentLocale = const Locale('fr'); + value == 'en' ? _currentLocale = const Locale('en') : _currentLocale = const Locale('fr'); }); }, value: _currentLocale.languageCode, items: const [ - DropdownMenuItem( - value: 'en', child: Text('English')), - DropdownMenuItem( - value: 'fr', child: Text('French')), + DropdownMenuItem(value: 'en', child: Text('English')), + DropdownMenuItem(value: 'fr', child: Text('French')), ], ) ], @@ -226,8 +231,7 @@ class _HomeScreenState extends State { await showModalBottomSheet( context: context, backgroundColor: Colors.transparent, - builder: (context) => - AtSignBottomSheet(atSignList: atSignList ?? []), + builder: (context) => AtSignBottomSheet(atSignList: atSignList ?? []), ); } setState(() {}); diff --git a/packages/at_onboarding_flutter/example/pubspec.yaml b/packages/at_onboarding_flutter/example/pubspec.yaml index 6e51d3f5..6a1f8719 100644 --- a/packages/at_onboarding_flutter/example/pubspec.yaml +++ b/packages/at_onboarding_flutter/example/pubspec.yaml @@ -45,6 +45,10 @@ dev_dependencies: dependency_overrides: intl: ^0.17.0 + at_onboarding_flutter: + path: ../ + # at_onboarding_flutter: ^6.1.5 + # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/packages/at_onboarding_flutter/lib/screen/at_onboarding_accounts_screen.dart b/packages/at_onboarding_flutter/lib/screen/at_onboarding_accounts_screen.dart index 155ca324..0391ac66 100644 --- a/packages/at_onboarding_flutter/lib/screen/at_onboarding_accounts_screen.dart +++ b/packages/at_onboarding_flutter/lib/screen/at_onboarding_accounts_screen.dart @@ -52,6 +52,7 @@ class _AtOnboardingAccountsScreenState Widget build(BuildContext context) { final theme = Theme.of(context).copyWith( primaryColor: widget.config.theme?.primaryColor, + textTheme: widget.config.theme?.textTheme, colorScheme: Theme.of(context).colorScheme.copyWith( primary: widget.config.theme?.primaryColor, ), diff --git a/packages/at_onboarding_flutter/lib/screen/at_onboarding_activate_screen.dart b/packages/at_onboarding_flutter/lib/screen/at_onboarding_activate_screen.dart index fd0e7923..eb7cad86 100644 --- a/packages/at_onboarding_flutter/lib/screen/at_onboarding_activate_screen.dart +++ b/packages/at_onboarding_flutter/lib/screen/at_onboarding_activate_screen.dart @@ -63,6 +63,7 @@ class _AtOnboardingActivateScreenState Widget build(BuildContext context) { final theme = Theme.of(context).copyWith( primaryColor: widget.config.theme?.primaryColor, + textTheme: widget.config.theme?.textTheme, colorScheme: Theme.of(context).colorScheme.copyWith( primary: widget.config.theme?.primaryColor, ), @@ -85,25 +86,27 @@ class _AtOnboardingActivateScreenState ], ), body: Center( - child: Container( - padding: const EdgeInsets.all(AtOnboardingDimens.paddingNormal), - margin: const EdgeInsets.all(AtOnboardingDimens.paddingNormal), - constraints: const BoxConstraints( - maxWidth: 400, - ), - child: Column( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - AtSyncIndicator( - color: theme.primaryColor, - ), - const SizedBox(height: 10), - Text( - AtOnboardingLocalizations.current.msg_wait_fetching_atSign, - ), - ], + child: SingleChildScrollView( + child: Container( + padding: const EdgeInsets.all(AtOnboardingDimens.paddingNormal), + margin: const EdgeInsets.all(AtOnboardingDimens.paddingNormal), + constraints: const BoxConstraints( + maxWidth: 400, + ), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + AtSyncIndicator( + color: theme.primaryColor, + ), + const SizedBox(height: 10), + Text( + AtOnboardingLocalizations.current.msg_wait_fetching_atSign, + ), + ], + ), ), ), ), diff --git a/packages/at_onboarding_flutter/lib/screen/at_onboarding_backup_screen.dart b/packages/at_onboarding_flutter/lib/screen/at_onboarding_backup_screen.dart index b72cf2ea..3d17d025 100644 --- a/packages/at_onboarding_flutter/lib/screen/at_onboarding_backup_screen.dart +++ b/packages/at_onboarding_flutter/lib/screen/at_onboarding_backup_screen.dart @@ -46,6 +46,7 @@ class _AtOnboardingBackupScreenState extends State { Widget build(BuildContext context) { final theme = Theme.of(context).copyWith( primaryColor: widget.config.theme?.primaryColor, + textTheme: widget.config.theme?.textTheme, colorScheme: Theme.of(context).colorScheme.copyWith( primary: widget.config.theme?.primaryColor, ), diff --git a/packages/at_onboarding_flutter/lib/screen/at_onboarding_generate_screen.dart b/packages/at_onboarding_flutter/lib/screen/at_onboarding_generate_screen.dart index 3dd2baa1..a3cf1a1f 100644 --- a/packages/at_onboarding_flutter/lib/screen/at_onboarding_generate_screen.dart +++ b/packages/at_onboarding_flutter/lib/screen/at_onboarding_generate_screen.dart @@ -192,6 +192,7 @@ class _AtOnboardingGenerateScreenState Widget build(BuildContext context) { final theme = Theme.of(context).copyWith( primaryColor: widget.config.theme?.primaryColor, + textTheme: widget.config.theme?.textTheme, colorScheme: Theme.of(context).colorScheme.copyWith( primary: widget.config.theme?.primaryColor, ), @@ -214,155 +215,159 @@ class _AtOnboardingGenerateScreenState ], ), body: Center( - child: Container( - decoration: BoxDecoration( - color: theme.primaryColor.withOpacity(0.1), - borderRadius: - BorderRadius.circular(AtOnboardingDimens.borderRadius)), - padding: const EdgeInsets.all(AtOnboardingDimens.paddingNormal), - margin: const EdgeInsets.all(AtOnboardingDimens.paddingNormal), - constraints: const BoxConstraints( - maxWidth: 400, - ), - child: Column( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Text( - AtOnboardingLocalizations.current.btn_generate_atSign, - style: const TextStyle( - fontSize: AtOnboardingDimens.fontLarge, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 5), - TextFormField( - enabled: false, - validator: (String? value) { - if ((value ?? '').isEmpty) { - return AtOnboardingLocalizations - .current.msg_atSign_cannot_empty; - } - return null; - }, - controller: _atsignController, - decoration: InputDecoration( - hintText: AtOnboardingStrings.atsignHintText, - prefix: Text( - '@', - style: TextStyle(color: theme.primaryColor), + child: SingleChildScrollView( + child: Container( + decoration: BoxDecoration( + color: theme.primaryColor.withOpacity(0.1), + borderRadius: + BorderRadius.circular(AtOnboardingDimens.borderRadius)), + padding: const EdgeInsets.all(AtOnboardingDimens.paddingNormal), + margin: const EdgeInsets.all(AtOnboardingDimens.paddingNormal), + constraints: const BoxConstraints( + maxWidth: 400, + ), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Text( + AtOnboardingLocalizations.current.btn_generate_atSign, + style: const TextStyle( + fontSize: AtOnboardingDimens.fontLarge, + fontWeight: FontWeight.bold, ), - border: OutlineInputBorder( - borderSide: BorderSide( - color: theme.primaryColor, + ), + const SizedBox(height: 5), + TextFormField( + enabled: false, + validator: (String? value) { + if ((value ?? '').isEmpty) { + return AtOnboardingLocalizations + .current.msg_atSign_cannot_empty; + } + return null; + }, + controller: _atsignController, + decoration: InputDecoration( + hintText: AtOnboardingStrings.atsignHintText, + prefix: Text( + '@', + style: TextStyle(color: theme.primaryColor), ), + border: OutlineInputBorder( + borderSide: BorderSide( + color: theme.primaryColor, + ), + ), + contentPadding: const EdgeInsets.symmetric( + horizontal: AtOnboardingDimens.paddingSmall), ), - contentPadding: const EdgeInsets.symmetric( - horizontal: AtOnboardingDimens.paddingSmall), - ), - ), - const SizedBox(height: 20), - Text( - AtOnboardingLocalizations.current.msg_refresh_atSign, - style: const TextStyle( - fontSize: AtOnboardingDimens.fontNormal, - // fontStyle: FontStyle.italic, ), - ), - const SizedBox(height: 6), - InkWell( - highlightColor: Colors.transparent, - splashColor: Colors.transparent, - onTap: _showReferenceWebview, - child: Text( - AtOnboardingLocalizations.current.learn_about_atSign, + const SizedBox(height: 20), + Text( + AtOnboardingLocalizations.current.msg_refresh_atSign, style: const TextStyle( fontSize: AtOnboardingDimens.fontNormal, - fontStyle: FontStyle.italic, - // fontWeight: FontWeight.w500, - decoration: TextDecoration.underline, + // fontStyle: FontStyle.italic, ), ), - ), - const SizedBox(height: 20), - AtOnboardingSecondaryButton( - key: keyGenerateAtSign, - height: 48, - borderRadius: 24, - onPressed: () async { - _getFreeAtsign(); - }, - isLoading: _isGenerating, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Center( - child: Text( - AtOnboardingLocalizations.current.btn_refresh, - style: const TextStyle( - fontSize: AtOnboardingDimens.fontLarge), - ), + const SizedBox(height: 6), + InkWell( + highlightColor: Colors.transparent, + splashColor: Colors.transparent, + onTap: _showReferenceWebview, + child: Text( + AtOnboardingLocalizations.current.learn_about_atSign, + style: const TextStyle( + fontSize: AtOnboardingDimens.fontNormal, + fontStyle: FontStyle.italic, + // fontWeight: FontWeight.w500, + decoration: TextDecoration.underline, ), - const Icon( - Icons.refresh, - size: 20, - ) - ], + ), ), - ), - const SizedBox(height: 20), - AtOnboardingPrimaryButton( - height: 48, - borderRadius: 24, - onPressed: _showPairScreen, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - AtOnboardingLocalizations.current.btn_pair, - style: const TextStyle( - fontSize: AtOnboardingDimens.fontLarge, + const SizedBox(height: 20), + AtOnboardingSecondaryButton( + key: keyGenerateAtSign, + height: 48, + borderRadius: 24, + onPressed: () async { + _getFreeAtsign(); + }, + isLoading: _isGenerating, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Center( + child: Text( + AtOnboardingLocalizations.current.btn_refresh, + style: const TextStyle( + fontSize: AtOnboardingDimens.fontLarge, + ), + ), ), - ), - const Icon( - Icons.arrow_right_alt_rounded, - ) - ], + const Icon( + Icons.refresh, + size: 20, + ) + ], + ), ), - ), - const SizedBox(height: 20), - InkWell( - onTap: () async { - if (widget.isFromIntroScreen) { - Navigator.push( - context, - MaterialPageRoute( - builder: (BuildContext context) { - return AtOnboardingHomeScreen( - config: widget.config, - ); - }, + const SizedBox(height: 20), + AtOnboardingPrimaryButton( + height: 48, + borderRadius: 24, + onPressed: _showPairScreen, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + AtOnboardingLocalizations.current.btn_pair, + style: const TextStyle( + fontSize: AtOnboardingDimens.fontLarge, + ), ), - ); - } else { - Navigator.of(context).pop(); - } - }, - highlightColor: Colors.transparent, - splashColor: Colors.transparent, - child: Text( - AtOnboardingLocalizations.current.btn_already_have_atSign, - key: keyHaveAnAtSign, - style: TextStyle( - fontSize: AtOnboardingDimens.fontNormal, - fontWeight: FontWeight.w500, - color: theme.primaryColor, - decoration: TextDecoration.underline, + const Icon( + Icons.arrow_right_alt_rounded, + ) + ], ), ), - ), - ], + const SizedBox(height: 20), + InkWell( + onTap: () async { + if (widget.isFromIntroScreen) { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) { + return AtOnboardingHomeScreen( + config: widget.config, + ); + }, + ), + ); + } else { + Navigator.of(context).pop(); + } + }, + highlightColor: Colors.transparent, + splashColor: Colors.transparent, + child: Text( + AtOnboardingLocalizations + .current.btn_already_have_atSign, + key: keyHaveAnAtSign, + style: TextStyle( + fontSize: AtOnboardingDimens.fontNormal, + fontWeight: FontWeight.w500, + color: theme.primaryColor, + decoration: TextDecoration.underline, + ), + ), + ), + ], + ), ), ), ), diff --git a/packages/at_onboarding_flutter/lib/screen/at_onboarding_home_screen.dart b/packages/at_onboarding_flutter/lib/screen/at_onboarding_home_screen.dart index cf8c471c..57d61dfa 100644 --- a/packages/at_onboarding_flutter/lib/screen/at_onboarding_home_screen.dart +++ b/packages/at_onboarding_flutter/lib/screen/at_onboarding_home_screen.dart @@ -617,6 +617,7 @@ class _AtOnboardingHomeScreenState extends State { Widget build(BuildContext context) { final theme = Theme.of(context).copyWith( primaryColor: widget.config.theme?.primaryColor, + textTheme: widget.config.theme?.textTheme, colorScheme: Theme.of(context).colorScheme.copyWith( primary: widget.config.theme?.primaryColor, ), @@ -640,139 +641,131 @@ class _AtOnboardingHomeScreenState extends State { ], ), body: Center( - child: Container( - // width: _dialogWidth, - decoration: BoxDecoration( - color: theme.primaryColor.withOpacity(0.1), - borderRadius: - BorderRadius.circular(AtOnboardingDimens.borderRadius)), - padding: const EdgeInsets.all(AtOnboardingDimens.paddingNormal), - margin: const EdgeInsets.all(AtOnboardingDimens.paddingNormal), - constraints: const BoxConstraints( - maxWidth: 400, - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.stretch, - mainAxisSize: MainAxisSize.min, - children: [ - Text( - AtOnboardingLocalizations.current.pair_atSign, - style: const TextStyle( - fontSize: AtOnboardingDimens.fontLarge, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 5), - AtOnboardingPrimaryButton( - key: keyUploadAtSign, - height: 48, - borderRadius: 24, - onPressed: (Platform.isMacOS || - Platform.isLinux || - Platform.isWindows) - ? _uploadKeyFileForDesktop - : _uploadKeyFile, - isLoading: loading, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - AtOnboardingLocalizations.current.upload_atKeys, - style: const TextStyle( - fontSize: AtOnboardingDimens.fontLarge, - ), - ), - const SizedBox(width: 10), - const Icon( - Icons.cloud_upload_rounded, - // size: 20, - ) - ], - ), - ), - const SizedBox(height: 5), - Text( - AtOnboardingLocalizations.current.sub_upload_atKeys, - style: const TextStyle( - fontSize: AtOnboardingDimens.fontSmall, - ), - ), - const SizedBox(height: 20), - if (!widget.hideQrScan) + child: SingleChildScrollView( + child: Container( + // width: _dialogWidth, + decoration: BoxDecoration( + color: theme.primaryColor.withOpacity(0.1), + borderRadius: + BorderRadius.circular(AtOnboardingDimens.borderRadius)), + padding: const EdgeInsets.all(AtOnboardingDimens.paddingNormal), + margin: const EdgeInsets.all(AtOnboardingDimens.paddingNormal), + constraints: const BoxConstraints( + maxWidth: 400, + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.stretch, + mainAxisSize: MainAxisSize.min, + children: [ Text( - AtOnboardingLocalizations - .current.title_activate_an_atSign, + AtOnboardingLocalizations.current.pair_atSign, style: const TextStyle( fontSize: AtOnboardingDimens.fontLarge, fontWeight: FontWeight.bold, ), ), - if (!widget.hideQrScan) const SizedBox(height: 5), - if (!widget.hideQrScan) - AtOnboardingSecondaryButton( - key: keyActivateAtSign, + const SizedBox(height: 5), + AtOnboardingPrimaryButton( + key: keyUploadAtSign, height: 48, borderRadius: 24, - onPressed: () async { - _showActiveScreen(context: context); - }, + onPressed: (Platform.isMacOS || + Platform.isLinux || + Platform.isWindows) + ? _uploadKeyFileForDesktop + : _uploadKeyFile, + isLoading: loading, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - AtOnboardingLocalizations - .current.btn_activate_atSign, + AtOnboardingLocalizations.current.upload_atKeys, style: const TextStyle( - fontSize: AtOnboardingDimens.fontLarge), + fontSize: AtOnboardingDimens.fontLarge, + ), ), - const Icon(Icons.arrow_right_alt_rounded) + const SizedBox(width: 10), + const Icon( + Icons.cloud_upload_rounded, + // size: 20, + ) ], ), ), - const SizedBox(height: 20), - Align( - alignment: Alignment.centerLeft, - child: InkWell( - onTap: () { - if (widget.isFromIntroScreen) { - Navigator.push( - context, - MaterialPageRoute( - builder: (_) => AtOnboardingGenerateScreen( - onGenerateSuccess: ({ - required String atSign, - required String secret, - }) { - String cramSecret = secret.split(':').last; - String atsign = atSign.startsWith('@') - ? atSign - : '@$atSign'; - _processSharedSecret(atsign, cramSecret); - }, - config: widget.config, - ), + const SizedBox(height: 5), + Text( + AtOnboardingLocalizations.current.sub_upload_atKeys, + style: const TextStyle( + fontSize: AtOnboardingDimens.fontSmall, + ), + ), + const SizedBox(height: 20), + if (!widget.hideQrScan) + AtOnboardingSecondaryButton( + key: keyActivateAtSign, + height: 48, + borderRadius: 24, + onPressed: () async { + _showActiveScreen(context: context); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + AtOnboardingLocalizations + .current.btn_activate_atSign, + style: const TextStyle( + fontSize: AtOnboardingDimens.fontLarge), ), - ); - } else { - Navigator.of(context).pop(); - } - }, - highlightColor: Colors.transparent, - splashColor: Colors.transparent, - child: Text( - AtOnboardingLocalizations.current.get_free_atSign, - key: keyCreateAnAtSign, - style: TextStyle( - fontSize: AtOnboardingDimens.fontNormal, - fontWeight: FontWeight.w500, - color: theme.primaryColor, - decoration: TextDecoration.underline, + const Icon(Icons.arrow_right_alt_rounded) + ], + ), + ), + const SizedBox(height: 20), + Align( + alignment: Alignment.centerLeft, + child: InkWell( + onTap: () { + if (widget.isFromIntroScreen) { + Navigator.push( + context, + MaterialPageRoute( + builder: (_) => AtOnboardingGenerateScreen( + onGenerateSuccess: ({ + required String atSign, + required String secret, + }) { + String cramSecret = secret.split(':').last; + String atsign = atSign.startsWith('@') + ? atSign + : '@$atSign'; + _processSharedSecret(atsign, cramSecret); + }, + config: widget.config, + ), + ), + ); + } else { + Navigator.of(context).pop(); + } + }, + highlightColor: Colors.transparent, + splashColor: Colors.transparent, + child: Text( + AtOnboardingLocalizations.current.get_free_atSign, + key: keyCreateAnAtSign, + style: TextStyle( + fontSize: AtOnboardingDimens.fontNormal, + fontWeight: FontWeight.w500, + color: theme.primaryColor, + decoration: TextDecoration.underline, + ), ), ), ), - ), - ], + ], + ), ), ), ), diff --git a/packages/at_onboarding_flutter/lib/screen/at_onboarding_input_atsign_screen.dart b/packages/at_onboarding_flutter/lib/screen/at_onboarding_input_atsign_screen.dart index 2f7e6c6a..e31c9409 100644 --- a/packages/at_onboarding_flutter/lib/screen/at_onboarding_input_atsign_screen.dart +++ b/packages/at_onboarding_flutter/lib/screen/at_onboarding_input_atsign_screen.dart @@ -31,6 +31,7 @@ class _AtOnboardingInputAtSignScreenState Widget build(BuildContext context) { final theme = Theme.of(context).copyWith( primaryColor: widget.config.theme?.primaryColor, + textTheme: widget.config.theme?.textTheme, colorScheme: Theme.of(context).colorScheme.copyWith( primary: widget.config.theme?.primaryColor, ), @@ -51,77 +52,79 @@ class _AtOnboardingInputAtSignScreenState ], ), body: Center( - child: Container( - decoration: BoxDecoration( - color: theme.primaryColor.withOpacity(0.1), - borderRadius: - BorderRadius.circular(AtOnboardingDimens.borderRadius)), - padding: const EdgeInsets.all(AtOnboardingDimens.paddingNormal), - margin: const EdgeInsets.all(AtOnboardingDimens.paddingNormal), - constraints: const BoxConstraints( - maxWidth: 400, - ), - child: Column( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Text( - AtOnboardingLocalizations.current.activate_an_atSign, - style: const TextStyle( - fontSize: AtOnboardingDimens.fontLarge, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 2), - Text( - AtOnboardingLocalizations - .current.enter_atSign_need_to_activate, - style: const TextStyle( - fontSize: AtOnboardingDimens.fontSmall, + child: SingleChildScrollView( + child: Container( + decoration: BoxDecoration( + color: theme.primaryColor.withOpacity(0.1), + borderRadius: + BorderRadius.circular(AtOnboardingDimens.borderRadius)), + padding: const EdgeInsets.all(AtOnboardingDimens.paddingNormal), + margin: const EdgeInsets.all(AtOnboardingDimens.paddingNormal), + constraints: const BoxConstraints( + maxWidth: 400, + ), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Text( + AtOnboardingLocalizations.current.activate_an_atSign, + style: const TextStyle( + fontSize: AtOnboardingDimens.fontLarge, + fontWeight: FontWeight.bold, + ), ), - ), - const SizedBox(height: 8), - TextFormField( - enabled: true, - validator: (String? value) { - if ((value ?? '').isEmpty) { - return AtOnboardingLocalizations - .current.msg_atSign_cannot_empty; - } - return null; - }, - controller: _atsignController, - decoration: InputDecoration( - hintText: AtOnboardingStrings.atsignHintText, - prefix: Text( - '@', - style: TextStyle(color: theme.primaryColor), + const SizedBox(height: 2), + Text( + AtOnboardingLocalizations + .current.enter_atSign_need_to_activate, + style: const TextStyle( + fontSize: AtOnboardingDimens.fontSmall, ), - border: OutlineInputBorder( - borderSide: BorderSide( - color: theme.primaryColor, + ), + const SizedBox(height: 8), + TextFormField( + enabled: true, + validator: (String? value) { + if ((value ?? '').isEmpty) { + return AtOnboardingLocalizations + .current.msg_atSign_cannot_empty; + } + return null; + }, + controller: _atsignController, + decoration: InputDecoration( + hintText: AtOnboardingStrings.atsignHintText, + prefix: Text( + '@', + style: TextStyle(color: theme.primaryColor), + ), + border: OutlineInputBorder( + borderSide: BorderSide( + color: theme.primaryColor, + ), ), + contentPadding: const EdgeInsets.symmetric( + horizontal: AtOnboardingDimens.paddingSmall), ), - contentPadding: const EdgeInsets.symmetric( - horizontal: AtOnboardingDimens.paddingSmall), ), - ), - const SizedBox(height: 20), - AtOnboardingPrimaryButton( - height: 48, - borderRadius: 24, - onPressed: _activateAtSign, - child: Center( - child: Text( - AtOnboardingLocalizations.current.activate, - style: const TextStyle( - fontSize: AtOnboardingDimens.fontLarge, + const SizedBox(height: 20), + AtOnboardingPrimaryButton( + height: 48, + borderRadius: 24, + onPressed: _activateAtSign, + child: Center( + child: Text( + AtOnboardingLocalizations.current.activate, + style: const TextStyle( + fontSize: AtOnboardingDimens.fontLarge, + ), ), ), ), - ), - ], + ], + ), ), ), ), diff --git a/packages/at_onboarding_flutter/lib/screen/at_onboarding_intro_screen.dart b/packages/at_onboarding_flutter/lib/screen/at_onboarding_intro_screen.dart index ce36e585..b51ac35a 100644 --- a/packages/at_onboarding_flutter/lib/screen/at_onboarding_intro_screen.dart +++ b/packages/at_onboarding_flutter/lib/screen/at_onboarding_intro_screen.dart @@ -34,6 +34,7 @@ class _AtOnboardingIntroScreenState extends State { Widget build(BuildContext context) { final theme = Theme.of(context).copyWith( primaryColor: widget.config.theme?.primaryColor, + textTheme: widget.config.theme?.textTheme, colorScheme: Theme.of(context).colorScheme.copyWith( primary: widget.config.theme?.primaryColor, ), @@ -55,64 +56,66 @@ class _AtOnboardingIntroScreenState extends State { centerTitle: true, ), body: Center( - child: Container( - decoration: BoxDecoration( - color: theme.primaryColor.withOpacity(0.1), - borderRadius: - BorderRadius.circular(AtOnboardingDimens.borderRadius)), - padding: const EdgeInsets.all(AtOnboardingDimens.paddingNormal), - margin: const EdgeInsets.all(AtOnboardingDimens.paddingNormal), - constraints: const BoxConstraints( - maxWidth: 400, - ), - child: Column( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - RichText( - text: TextSpan( - text: AtOnboardingLocalizations.current.title_intro, - style: theme.textTheme.titleMedium, - children: [ - TextSpan( - text: AtOnboardingLocalizations.current.learn_more, - style: TextStyle( - fontSize: AtOnboardingDimens.fontLarge, - fontWeight: FontWeight.w500, - color: theme.primaryColor, - decoration: TextDecoration.underline, + child: SingleChildScrollView( + child: Container( + decoration: BoxDecoration( + color: theme.primaryColor.withOpacity(0.1), + borderRadius: + BorderRadius.circular(AtOnboardingDimens.borderRadius)), + padding: const EdgeInsets.all(AtOnboardingDimens.paddingNormal), + margin: const EdgeInsets.all(AtOnboardingDimens.paddingNormal), + constraints: const BoxConstraints( + maxWidth: 400, + ), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + RichText( + text: TextSpan( + text: AtOnboardingLocalizations.current.title_intro, + style: theme.textTheme.titleMedium, + children: [ + TextSpan( + text: AtOnboardingLocalizations.current.learn_more, + style: TextStyle( + fontSize: AtOnboardingDimens.fontLarge, + fontWeight: FontWeight.w500, + color: theme.primaryColor, + decoration: TextDecoration.underline, + ), + recognizer: TapGestureRecognizer() + ..onTap = _showReferenceWebview, ), - recognizer: TapGestureRecognizer() - ..onTap = _showReferenceWebview, - ), - ], + ], + ), + textAlign: TextAlign.center, ), - textAlign: TextAlign.center, - ), - const SizedBox(height: 16), - AtOnboardingPrimaryButton( - height: 48, - borderRadius: 24, - child: Text( - AtOnboardingLocalizations.current.already_have_an_atSign, + const SizedBox(height: 16), + AtOnboardingPrimaryButton( + height: 48, + borderRadius: 24, + child: Text( + AtOnboardingLocalizations.current.already_have_an_atSign, + ), + onPressed: () { + _navigateToHomePage(true); + }, ), - onPressed: () { - _navigateToHomePage(true); - }, - ), - const SizedBox(height: 16), - AtOnboardingSecondaryButton( - height: 48, - borderRadius: 24, - child: Text( - AtOnboardingLocalizations.current.get_free_atSign, + const SizedBox(height: 16), + AtOnboardingSecondaryButton( + height: 48, + borderRadius: 24, + child: Text( + AtOnboardingLocalizations.current.get_free_atSign, + ), + onPressed: () { + _navigateToHomePage(false); + }, ), - onPressed: () { - _navigateToHomePage(false); - }, - ), - ], + ], + ), ), ), ), diff --git a/packages/at_onboarding_flutter/lib/screen/at_onboarding_otp_screen.dart b/packages/at_onboarding_flutter/lib/screen/at_onboarding_otp_screen.dart index 0214bbff..27066456 100644 --- a/packages/at_onboarding_flutter/lib/screen/at_onboarding_otp_screen.dart +++ b/packages/at_onboarding_flutter/lib/screen/at_onboarding_otp_screen.dart @@ -91,6 +91,7 @@ class _AtOnboardingOTPScreenState extends State { Widget build(BuildContext context) { final theme = Theme.of(context).copyWith( primaryColor: widget.config.theme?.primaryColor, + textTheme: widget.config.theme?.textTheme, colorScheme: Theme.of(context).colorScheme.copyWith( primary: widget.config.theme?.primaryColor, ), diff --git a/packages/at_onboarding_flutter/lib/screen/at_onboarding_pair_screen.dart b/packages/at_onboarding_flutter/lib/screen/at_onboarding_pair_screen.dart index 8e9fd74d..4e117f7a 100644 --- a/packages/at_onboarding_flutter/lib/screen/at_onboarding_pair_screen.dart +++ b/packages/at_onboarding_flutter/lib/screen/at_onboarding_pair_screen.dart @@ -61,6 +61,7 @@ class _AtOnboardingPairScreenState extends State { Widget build(BuildContext context) { final theme = Theme.of(context).copyWith( primaryColor: widget.config.theme?.primaryColor, + textTheme: widget.config.theme?.textTheme, colorScheme: Theme.of(context).colorScheme.copyWith( primary: widget.config.theme?.primaryColor, ), @@ -84,100 +85,102 @@ class _AtOnboardingPairScreenState extends State { ], ), body: Center( - child: Container( - decoration: BoxDecoration( - color: theme.primaryColor.withOpacity(0.1), - borderRadius: - BorderRadius.circular(AtOnboardingDimens.borderRadius)), - padding: const EdgeInsets.all(AtOnboardingDimens.paddingNormal), - margin: const EdgeInsets.all(AtOnboardingDimens.paddingNormal), - constraints: const BoxConstraints( - maxWidth: 400, - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.stretch, - mainAxisSize: MainAxisSize.min, - children: [ - Text( - AtOnboardingLocalizations.current.enter_your_email_address, - style: const TextStyle( - fontSize: AtOnboardingDimens.fontLarge, - fontWeight: FontWeight.bold, + child: SingleChildScrollView( + child: Container( + decoration: BoxDecoration( + color: theme.primaryColor.withOpacity(0.1), + borderRadius: + BorderRadius.circular(AtOnboardingDimens.borderRadius)), + padding: const EdgeInsets.all(AtOnboardingDimens.paddingNormal), + margin: const EdgeInsets.all(AtOnboardingDimens.paddingNormal), + constraints: const BoxConstraints( + maxWidth: 400, + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.stretch, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + AtOnboardingLocalizations.current.enter_your_email_address, + style: const TextStyle( + fontSize: AtOnboardingDimens.fontLarge, + fontWeight: FontWeight.bold, + ), ), - ), - const SizedBox(height: 5), - TextFormField( - enabled: true, - focusNode: _focusNode, - validator: (String? value) { - if ((value ?? '').isEmpty) { - return AtOnboardingLocalizations - .current.msg_atSign_cannot_empty; - } - return null; - }, - controller: _emailController, - inputFormatters: [ - LengthLimitingTextInputFormatter(80), - // This inputFormatter function will convert all the input to lowercase. - TextInputFormatter.withFunction( - (TextEditingValue oldValue, - TextEditingValue newValue) { - return newValue.copyWith( - text: newValue.text.toLowerCase(), - selection: newValue.selection, - ); - }) - ], - textCapitalization: TextCapitalization.none, - decoration: InputDecoration( - fillColor: Colors.blueAccent, - errorStyle: const TextStyle(fontSize: 12), - prefixStyle: - TextStyle(color: theme.primaryColor, fontSize: 15), - border: OutlineInputBorder( - borderSide: BorderSide( - color: theme.primaryColor, + const SizedBox(height: 5), + TextFormField( + enabled: true, + focusNode: _focusNode, + validator: (String? value) { + if ((value ?? '').isEmpty) { + return AtOnboardingLocalizations + .current.msg_atSign_cannot_empty; + } + return null; + }, + controller: _emailController, + inputFormatters: [ + LengthLimitingTextInputFormatter(80), + // This inputFormatter function will convert all the input to lowercase. + TextInputFormatter.withFunction( + (TextEditingValue oldValue, + TextEditingValue newValue) { + return newValue.copyWith( + text: newValue.text.toLowerCase(), + selection: newValue.selection, + ); + }) + ], + textCapitalization: TextCapitalization.none, + decoration: InputDecoration( + fillColor: Colors.blueAccent, + errorStyle: const TextStyle(fontSize: 12), + prefixStyle: + TextStyle(color: theme.primaryColor, fontSize: 15), + border: OutlineInputBorder( + borderSide: BorderSide( + color: theme.primaryColor, + ), ), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Colors.grey[500]!, + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.grey[500]!, + ), ), + contentPadding: const EdgeInsets.symmetric( + horizontal: AtOnboardingDimens.paddingSmall), ), - contentPadding: const EdgeInsets.symmetric( - horizontal: AtOnboardingDimens.paddingSmall), ), - ), - const SizedBox(height: 10), - Text( - AtOnboardingLocalizations.current.note_pair_content, - style: const TextStyle( - fontWeight: FontWeight.w600, - fontSize: AtOnboardingDimens.fontNormal, + const SizedBox(height: 10), + Text( + AtOnboardingLocalizations.current.note_pair_content, + style: const TextStyle( + fontWeight: FontWeight.w600, + fontSize: AtOnboardingDimens.fontNormal, + ), ), - ), - const SizedBox(height: 20), - AtOnboardingPrimaryButton( - height: 48, - borderRadius: 24, - isLoading: isParing, - onPressed: _onSendCodePressed, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - AtOnboardingLocalizations.current.send_code, - style: const TextStyle( - fontSize: AtOnboardingDimens.fontLarge, + const SizedBox(height: 20), + AtOnboardingPrimaryButton( + height: 48, + borderRadius: 24, + isLoading: isParing, + onPressed: _onSendCodePressed, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + AtOnboardingLocalizations.current.send_code, + style: const TextStyle( + fontSize: AtOnboardingDimens.fontLarge, + ), ), - ), - const Icon(Icons.arrow_right_alt_rounded) - ], + const Icon(Icons.arrow_right_alt_rounded) + ], + ), ), - ), - ], + ], + ), ), ), ), diff --git a/packages/at_onboarding_flutter/lib/screen/at_onboarding_qrcode_screen.dart b/packages/at_onboarding_flutter/lib/screen/at_onboarding_qrcode_screen.dart index cb7b0f92..a3361e72 100644 --- a/packages/at_onboarding_flutter/lib/screen/at_onboarding_qrcode_screen.dart +++ b/packages/at_onboarding_flutter/lib/screen/at_onboarding_qrcode_screen.dart @@ -100,6 +100,7 @@ class _AtOnboardingQRCodeScreenState extends State { Widget build(BuildContext context) { final theme = Theme.of(context).copyWith( primaryColor: widget.config.theme?.primaryColor, + textTheme: widget.config.theme?.textTheme, colorScheme: Theme.of(context).colorScheme.copyWith( primary: widget.config.theme?.primaryColor, ), diff --git a/packages/at_onboarding_flutter/lib/screen/at_onboarding_reference_screen.dart b/packages/at_onboarding_flutter/lib/screen/at_onboarding_reference_screen.dart index 718f575c..9df1872e 100644 --- a/packages/at_onboarding_flutter/lib/screen/at_onboarding_reference_screen.dart +++ b/packages/at_onboarding_flutter/lib/screen/at_onboarding_reference_screen.dart @@ -83,6 +83,7 @@ class _AtOnboardingReferenceScreenState Widget build(BuildContext context) { final theme = Theme.of(context).copyWith( primaryColor: widget.config.theme?.primaryColor, + textTheme: widget.config.theme?.textTheme, colorScheme: Theme.of(context).colorScheme.copyWith( primary: widget.config.theme?.primaryColor, ), diff --git a/packages/at_onboarding_flutter/lib/screen/at_onboarding_reset_screen.dart b/packages/at_onboarding_flutter/lib/screen/at_onboarding_reset_screen.dart index c6c6b7d4..9a70f068 100644 --- a/packages/at_onboarding_flutter/lib/screen/at_onboarding_reset_screen.dart +++ b/packages/at_onboarding_flutter/lib/screen/at_onboarding_reset_screen.dart @@ -48,6 +48,7 @@ class _AtOnboardingResetScreenState extends State { Widget build(BuildContext context) { final theme = Theme.of(context).copyWith( primaryColor: widget.config.theme?.primaryColor, + textTheme: widget.config.theme?.textTheme, colorScheme: Theme.of(context).colorScheme.copyWith( primary: widget.config.theme?.primaryColor, ), diff --git a/packages/at_onboarding_flutter/lib/screen/at_onboarding_start_screen.dart b/packages/at_onboarding_flutter/lib/screen/at_onboarding_start_screen.dart index bbb2ad54..bc2d6811 100644 --- a/packages/at_onboarding_flutter/lib/screen/at_onboarding_start_screen.dart +++ b/packages/at_onboarding_flutter/lib/screen/at_onboarding_start_screen.dart @@ -109,6 +109,7 @@ class _AtOnboardingStartScreenState extends State { Widget build(BuildContext context) { final theme = Theme.of(context).copyWith( primaryColor: widget.config.theme?.primaryColor, + textTheme: widget.config.theme?.textTheme, colorScheme: Theme.of(context).colorScheme.copyWith( primary: widget.config.theme?.primaryColor, ), @@ -119,22 +120,24 @@ class _AtOnboardingStartScreenState extends State { child: Scaffold( backgroundColor: Colors.transparent, body: Center( - child: Container( - padding: const EdgeInsets.all(AtOnboardingDimens.paddingNormal), - decoration: BoxDecoration( - color: theme.scaffoldBackgroundColor, - borderRadius: - BorderRadius.circular(AtOnboardingDimens.dialogBorderRadius), - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - AtSyncIndicator(color: theme.primaryColor), - const SizedBox(width: AtOnboardingDimens.paddingSmall), - Text( - AtOnboardingLocalizations.current.onboarding, - ), - ], + child: SingleChildScrollView( + child: Container( + padding: const EdgeInsets.all(AtOnboardingDimens.paddingNormal), + decoration: BoxDecoration( + color: theme.scaffoldBackgroundColor, + borderRadius: + BorderRadius.circular(AtOnboardingDimens.dialogBorderRadius), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + AtSyncIndicator(color: theme.primaryColor), + const SizedBox(width: AtOnboardingDimens.paddingSmall), + Text( + AtOnboardingLocalizations.current.onboarding, + ), + ], + ), ), ), ), diff --git a/packages/at_onboarding_flutter/lib/services/at_onboarding_theme.dart b/packages/at_onboarding_flutter/lib/services/at_onboarding_theme.dart index 4d2f2a2a..81434999 100644 --- a/packages/at_onboarding_flutter/lib/services/at_onboarding_theme.dart +++ b/packages/at_onboarding_flutter/lib/services/at_onboarding_theme.dart @@ -3,8 +3,10 @@ import 'package:flutter/material.dart'; class AtOnboardingTheme { ///set primary color for Onboarding final Color? primaryColor; + final TextTheme? textTheme; AtOnboardingTheme({ this.primaryColor, + this.textTheme, }); }