Skip to content

Commit 19838bd

Browse files
authored
Merge pull request #44 from JDI-Group/redesign
Redesign
2 parents 21f308f + e9fc4d9 commit 19838bd

File tree

11 files changed

+101
-79
lines changed

11 files changed

+101
-79
lines changed

android/app/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ android {
6262
// You can update the following values to match your application needs.
6363
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
6464
minSdkVersion 21
65+
minSdk 21
66+
manifestPlaceholders = [
67+
minSdkVersion: "21",
68+
applicationName: "android.app.Application"
69+
]
6570
targetSdkVersion rootProject.ext.targetSdkVersion
6671
versionCode System.getenv('VERSION_CODE')?.hashCode()?.abs() ?: 404
6772
versionName flutterVersionName

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
}
77

88
dependencies {
9-
classpath 'com.android.tools.build:gradle:8.2.1'
9+
classpath 'com.android.tools.build:gradle:8.4.0'
1010
// START: FlutterFire Configuration
1111
classpath 'com.google.gms:google-services:4.3.15'
1212
// END: FlutterFire Configuration

android/gradle.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
org.gradle.jvmargs=-Xmx1536M
22
android.useAndroidX=true
33
android.enableJetifier=true
4-
kotlin.jvm.target.validation.mode = IGNORE
4+
kotlin.jvm.target.validation.mode = IGNORE
5+
android.ndk.suppressMinSdkVersionError=21

android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip

lib/app/app.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class MXCWallet extends HookConsumerWidget {
4747
for (final l in languageState.supportedLanguages) l.toLocale(),
4848
],
4949
navigatorKey: appNavigatorKey,
50+
scaffoldMessengerKey: RootScaffoldMessenger.key,
5051
onGenerateRoute: (_) => null,
5152
builder: (context, child) {
5253
child = Navigator(
@@ -95,3 +96,14 @@ class MXCWallet extends HookConsumerWidget {
9596
);
9697
}
9798
}
99+
100+
101+
// Global scaffold messenger utility
102+
class RootScaffoldMessenger {
103+
static final GlobalKey<ScaffoldMessengerState> key =
104+
GlobalKey<ScaffoldMessengerState>();
105+
106+
static void showSnackBar(SnackBar snackBar) {
107+
key.currentState?.showSnackBar(snackBar);
108+
}
109+
}

lib/common/components/snackbar/snackbar.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'package:moonchain_wallet/app/app.dart';
12
import 'package:moonchain_wallet/common/common.dart';
23
import 'package:flutter/material.dart';
34
import 'package:mxc_ui/mxc_ui.dart';
@@ -221,6 +222,7 @@ void showSnackBar({
221222
behavior: SnackBarBehavior.floating,
222223
);
223224

225+
RootScaffoldMessenger.key.currentState?.clearSnackBars();
224226
ScaffoldMessenger.of(context).clearSnackBars();
225-
ScaffoldMessenger.of(context).showSnackBar(snackBar);
227+
RootScaffoldMessenger.showSnackBar(snackBar);
226228
}

lib/common/layout/mxc_page.dart

Lines changed: 35 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -272,44 +272,42 @@ abstract class MxcPage extends HookConsumerWidget {
272272
decoration: BoxDecoration(
273273
gradient: backgroundGradient,
274274
),
275-
child: ScaffoldMessenger(
276-
child: Scaffold(
277-
backgroundColor: resolveBackgroundColor(context),
278-
extendBodyBehindAppBar: extendBodyBehindAppBar,
279-
drawer: drawer,
280-
key: scaffoldKey,
281-
resizeToAvoidBottomInset: false,
282-
floatingActionButton: floatingActionButton,
283-
bottomNavigationBar: buildBottomNavigation(context, ref),
284-
floatingActionButtonLocation: floatingActionButtonLocation,
285-
body: PresenterHooks(
286-
presenter: presenter,
287-
child: paintBackground(
288-
context: context,
289-
splashBackgroundVisible: useSplashBackground,
290-
useBlackBackground: useBlackBackground,
291-
gradientBackgroundVisible: useGradientBackground,
292-
child: SafeArea(
293-
bottom: maintainBottomSafeArea,
294-
top: topSafeArea,
295-
child: Column(
296-
children: [
297-
buildAppBar(context, ref),
298-
Expanded(
299-
child: Padding(
300-
padding: childrenPadding ?? EdgeInsets.zero,
301-
child: content(context, ref),
302-
)),
303-
if (placeBottomInsetFiller)
304-
AnimatedSize(
305-
curve: Curves.easeOutQuad,
306-
duration: const Duration(milliseconds: 275),
307-
child: SizedBox(
308-
height: MediaQuery.of(context).viewInsets.bottom,
309-
),
275+
child: Scaffold(
276+
backgroundColor: resolveBackgroundColor(context),
277+
extendBodyBehindAppBar: extendBodyBehindAppBar,
278+
drawer: drawer,
279+
key: scaffoldKey,
280+
resizeToAvoidBottomInset: false,
281+
floatingActionButton: floatingActionButton,
282+
bottomNavigationBar: buildBottomNavigation(context, ref),
283+
floatingActionButtonLocation: floatingActionButtonLocation,
284+
body: PresenterHooks(
285+
presenter: presenter,
286+
child: paintBackground(
287+
context: context,
288+
splashBackgroundVisible: useSplashBackground,
289+
useBlackBackground: useBlackBackground,
290+
gradientBackgroundVisible: useGradientBackground,
291+
child: SafeArea(
292+
bottom: maintainBottomSafeArea,
293+
top: topSafeArea,
294+
child: Column(
295+
children: [
296+
buildAppBar(context, ref),
297+
Expanded(
298+
child: Padding(
299+
padding: childrenPadding ?? EdgeInsets.zero,
300+
child: content(context, ref),
301+
)),
302+
if (placeBottomInsetFiller)
303+
AnimatedSize(
304+
curve: Curves.easeOutQuad,
305+
duration: const Duration(milliseconds: 275),
306+
child: SizedBox(
307+
height: MediaQuery.of(context).viewInsets.bottom,
310308
),
311-
],
312-
),
309+
),
310+
],
313311
),
314312
),
315313
),

lib/common/layout/mxc_page_layer.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ class MxcPageLayer extends MxcPage {
8484
return upperBackgroundColor!;
8585
}
8686
if (BottomFlowDialog.maybeOf(context) != null) {
87-
return ColorsTheme.of(context).darkBlue;
87+
return ColorsTheme.of(context).darkGray;
8888
}
89-
return ColorsTheme.of(context).darkBlue;
89+
return ColorsTheme.of(context).darkGray;
9090
}
9191

9292
@override

lib/features/common/app_nav_bar/app_nav_bar_presenter.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ class AppNavPresenter extends CompletePresenter<AppNavBarState> {
5757
addMessage(tip);
5858
}
5959

60-
void addNewAccount() async {
61-
notify(() => state.isLoading = true);
60+
Future<void> addNewAccount() async {
61+
if (loading) return;
62+
loading = true;
6263

6364
try {
6465
final index = _accountUseCase.findAccountsLastIndex();
@@ -67,8 +68,8 @@ class AppNavPresenter extends CompletePresenter<AppNavBarState> {
6768
_accountUseCase.addAccount(newAccount, index: index);
6869
loadCache();
6970

70-
notify(() => state.isLoading = false);
7171
navigator!.pop();
72+
loading = false;
7273
} catch (e, s) {
7374
addError(e, s);
7475
}

lib/features/wallet/presentation/wallet_page.dart

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -28,38 +28,39 @@ class WalletPage extends HookConsumerWidget {
2828
: state.txList!;
2929

3030
return MxcPage(
31-
useAppBar: true,
32-
presenter: presenter,
33-
resizeToAvoidBottomInset: true,
34-
useBlackBackground: true,
35-
layout: LayoutType.column,
36-
useContentPadding: false,
37-
appBar: AppNavBar(
38-
action: IconButton(
39-
key: const ValueKey('settingsButton'),
40-
icon: SvgPicture.asset(
41-
assets.Assets.svg.settingsSvg,
42-
height: 28,
43-
width: 28,
44-
fit: BoxFit.fill,
45-
colorFilter: ColorFilter.mode(
46-
ColorsTheme.of(context).white100, BlendMode.srcIn),
47-
),
48-
iconSize: Sizes.space2XLarge,
49-
onPressed: () {
50-
Navigator.of(context).push(
51-
route(
52-
const SettingsPage(),
53-
),
54-
);
55-
},
56-
color: ColorsTheme.of(context).iconPrimary,
31+
useAppBar: true,
32+
presenter: presenter,
33+
resizeToAvoidBottomInset: true,
34+
backgroundColor: Colors.black,
35+
layout: LayoutType.column,
36+
useContentPadding: false,
37+
extendBodyBehindAppBar: true,
38+
appBar: AppNavBar(
39+
action: IconButton(
40+
key: const ValueKey('settingsButton'),
41+
icon: SvgPicture.asset(
42+
assets.Assets.svg.settingsSvg,
43+
height: 28,
44+
width: 28,
45+
fit: BoxFit.fill,
46+
colorFilter: ColorFilter.mode(
47+
ColorsTheme.of(context).white100, BlendMode.srcIn),
5748
),
58-
leadingType: LeadingType.walletAddress,
49+
iconSize: Sizes.space2XLarge,
50+
onPressed: () {
51+
Navigator.of(context).push(
52+
route(
53+
const SettingsPage(),
54+
),
55+
);
56+
},
57+
color: ColorsTheme.of(context).iconPrimary,
5958
),
60-
children: [
61-
Expanded(
62-
child: ListView(
59+
leadingType: LeadingType.walletAddress,
60+
),
61+
children: [
62+
Expanded(
63+
child: ListView(
6364
children: [
6465
Padding(
6566
padding: const EdgeInsets.only(top: 24, right: 24, left: 24),
@@ -103,7 +104,9 @@ class WalletPage extends HookConsumerWidget {
103104
),
104105
),
105106
],
106-
))
107-
]);
107+
),
108+
),
109+
],
110+
);
108111
}
109112
}

0 commit comments

Comments
 (0)