Skip to content

Commit

Permalink
Merge pull request #793 from atsign-foundation/fix/theme_issues_fix
Browse files Browse the repository at this point in the history
fix: theme issues and overflow fix
  • Loading branch information
CurtlyCritchlow authored Jun 12, 2024
2 parents 0a41181 + 8f74bc2 commit 4efdfbf
Show file tree
Hide file tree
Showing 17 changed files with 542 additions and 512 deletions.
1 change: 1 addition & 0 deletions .github/workflows/melos_bootstrap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
60 changes: 32 additions & 28 deletions packages/at_onboarding_flutter/example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -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<void> main() async {
await AtEnv.load();
Expand All @@ -22,8 +22,7 @@ Future<AtClientPreference> loadAtClientPreference() async {
..isLocalStoreRequired = true;
}

final StreamController<ThemeMode> updateThemeMode =
StreamController<ThemeMode>.broadcast();
final StreamController<ThemeMode> updateThemeMode = StreamController<ThemeMode>.broadcast();

class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
Expand Down Expand Up @@ -52,16 +51,14 @@ class MyAppState extends State<MyApp> {
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 [
Expand All @@ -81,9 +78,7 @@ class MyAppState extends State<MyApp> {
actions: <Widget>[
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
Expand Down Expand Up @@ -114,7 +109,15 @@ class MyAppState extends State<MyApp> {
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,
),
Expand All @@ -123,10 +126,7 @@ class MyAppState extends State<MyApp> {

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:
Expand Down Expand Up @@ -156,6 +156,15 @@ class MyAppState extends State<MyApp> {
domain: AtEnv.rootDomain,
rootEnvironment: AtEnv.rootEnvironment,
appAPIKey: AtEnv.appApiKey,
theme: AtOnboardingTheme(
primaryColor: Colors.blue,
textTheme: const TextTheme(
titleMedium: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
),
),
),
),
);
}
Expand All @@ -171,17 +180,13 @@ class MyAppState extends State<MyApp> {
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')),
],
)
],
Expand Down Expand Up @@ -226,8 +231,7 @@ class _HomeScreenState extends State<HomeScreen> {
await showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (context) =>
AtSignBottomSheet(atSignList: atSignList ?? []),
builder: (context) => AtSignBottomSheet(atSignList: atSignList ?? []),
);
}
setState(() {});
Expand Down
4 changes: 4 additions & 0 deletions packages/at_onboarding_flutter/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
Expand All @@ -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,
),
],
),
),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class _AtOnboardingBackupScreenState extends State<AtOnboardingBackupScreen> {
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,
),
Expand Down
Loading

0 comments on commit 4efdfbf

Please sign in to comment.