Skip to content

Commit b8875e5

Browse files
Eldar2021clangenb
andauthored
Bump Flutter v3.10.3 & Dart SDK >=3.0.1 <4.0.0" (#1259)
* bump flutter&&dart versions * impeller enable for IOS * fix depracated callback_dispatcher test * Delete BazaarSearch widget * bump test version * Try fix melos error * Migrate to dart 3 Part 2 (refactoring `switch case`) (#1260) * change melos version * migrated switch case to dart 3 * v1.10.0 * migrate swithc case in ew_http to dart 3 * tested on IOS & Android * Migrate to Material 3 (#1245) * try Migrate to Material 3 (01) * try fix Iphone 8 plus CI test --------- Co-authored-by: clangenb <37865735+clangenb@users.noreply.github.com> --------- Co-authored-by: clangenb <37865735+clangenb@users.noreply.github.com> * refactored by comments --------- Co-authored-by: clangenb <37865735+clangenb@users.noreply.github.com>
1 parent 0705a00 commit b8875e5

File tree

42 files changed

+248
-367
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+248
-367
lines changed

.flutter

Submodule .flutter updated 3298 files

.vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"dart.flutterSdkPath": ".flutter",
33
"dart.lineLength": 120,
44
"git.ignoreLimitWarning": true,
5-
"explorer.autoReveal": false,
5+
"explorer.autoReveal": false,
66
}

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ Encointer wallet and client for mobile phones
2828
</p>
2929

3030
### Requirements
31-
- Dart sdk: ">=2.19.0 <3.0.0"
32-
- Flutter: "3.7.12"
31+
- Dart sdk: ">=3.0.1 <3.0.0"
32+
- Flutter: "3.10.3"
3333
- Android: minSdkVersion 17
3434
- iOS: --ios-language swift, Xcode version >= 14.0.0
3535

app/android/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ subprojects {
2626
project.evaluationDependsOn(':app')
2727
}
2828

29-
task clean(type: Delete) {
29+
tasks.register("clean", Delete) {
3030
delete rootProject.buildDir
3131
}

app/ios/Podfile.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,12 @@ DEPENDENCIES:
126126
- local_auth_ios (from `.symlinks/plugins/local_auth_ios/ios`)
127127
- mobile_scanner (from `.symlinks/plugins/mobile_scanner/ios`)
128128
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
129-
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`)
129+
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
130130
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
131131
- printing (from `.symlinks/plugins/printing/ios`)
132132
- screen_brightness_ios (from `.symlinks/plugins/screen_brightness_ios/ios`)
133133
- share_plus (from `.symlinks/plugins/share_plus/ios`)
134-
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`)
134+
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
135135
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
136136
- wakelock (from `.symlinks/plugins/wakelock/ios`)
137137

@@ -183,7 +183,7 @@ EXTERNAL SOURCES:
183183
package_info_plus:
184184
:path: ".symlinks/plugins/package_info_plus/ios"
185185
path_provider_foundation:
186-
:path: ".symlinks/plugins/path_provider_foundation/ios"
186+
:path: ".symlinks/plugins/path_provider_foundation/darwin"
187187
permission_handler_apple:
188188
:path: ".symlinks/plugins/permission_handler_apple/ios"
189189
printing:
@@ -193,7 +193,7 @@ EXTERNAL SOURCES:
193193
share_plus:
194194
:path: ".symlinks/plugins/share_plus/ios"
195195
shared_preferences_foundation:
196-
:path: ".symlinks/plugins/shared_preferences_foundation/ios"
196+
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
197197
url_launcher_ios:
198198
:path: ".symlinks/plugins/url_launcher_ios/ios"
199199
wakelock:

app/ios/Runner.xcodeproj/project.pbxproj

+1
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@
301301
files = (
302302
);
303303
inputPaths = (
304+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
304305
);
305306
name = "Thin Binary";
306307
outputPaths = (

app/ios/Runner/Info.plist

+3
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@
104104
<!-- local_auth -->
105105
<key>NSFaceIDUsageDescription</key>
106106
<string>Used to unlock the app to send transactions to other members</string>
107+
<!-- Impeller -->
108+
<key>FLTEnableImpeller</key>
109+
<true/>
107110
<!-- ... other tags -->
108111
<key>UIApplicationSupportsIndirectInputEvents</key>
109112
<true/>

app/lib/app.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class WalletApp extends StatelessWidget {
2727
child: Observer(builder: (_) {
2828
return MaterialApp(
2929
title: 'EncointerWallet',
30-
locale: context.watch<AppSettings>().locale,
30+
locale: appSettings.locale,
3131
localizationsDelegates: [
3232
AppLocalizationsDelegate(appSettings.locale),
3333
GlobalMaterialLocalizations.delegate,

app/lib/config/consts.dart

+10-19
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import 'dart:io';
22

33
import 'package:encointer_wallet/config/node.dart';
44
import 'package:encointer_wallet/config/prod_community.dart';
5-
import 'package:encointer_wallet/service/log/log_service.dart';
65
import 'package:encointer_wallet/store/settings.dart';
76

87
const String androidLocalHost = '10.0.2.2';
@@ -119,25 +118,17 @@ const assignmentFAQLinkEN = 'https://leu.zuerich/en/#why-have-i-not-been-assigne
119118
const assignmentFAQLinkDE = 'https://leu.zuerich/#warum-wurde-ich-keinem-cycle-zugewiesen';
120119

121120
String leuZurichCycleAssignmentFAQLink(String locale) {
122-
switch (locale) {
123-
case 'en':
124-
return assignmentFAQLinkEN;
125-
case 'de':
126-
return assignmentFAQLinkDE;
127-
default:
128-
Log.d('[replaceLocale] unsupported locale, defaulting to english', 'consts.dart');
129-
return assignmentFAQLinkEN;
130-
}
121+
return switch (locale) {
122+
'en' => assignmentFAQLinkEN,
123+
'de' => assignmentFAQLinkDE,
124+
_ => assignmentFAQLinkEN,
125+
};
131126
}
132127

133128
String replaceLocalePlaceholder(String link, String locale) {
134-
switch (locale) {
135-
case 'en':
136-
return link.replaceAll(localePlaceHolder, 'en');
137-
case 'de':
138-
return link.replaceAll(localePlaceHolder, '');
139-
default:
140-
Log.d('[replaceLocale] unsupported locale, defaulting to english', 'consts.dart');
141-
return link.replaceAll(localePlaceHolder, 'en');
142-
}
129+
return switch (locale) {
130+
'en' => link.replaceAll(localePlaceHolder, 'en'),
131+
'de' => link.replaceAll(localePlaceHolder, ''),
132+
_ => link.replaceAll(localePlaceHolder, 'en'),
133+
};
143134
}

app/lib/models/transfer/transfer_history.dart

+4-6
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,9 @@ enum TransactionType {
5555

5656
String getText(BuildContext context) {
5757
final dic = I18n.of(context)!.translationsForLocale().transaction;
58-
switch (this) {
59-
case TransactionType.outgoing:
60-
return dic.sent;
61-
case TransactionType.incoming:
62-
return dic.received;
63-
}
58+
return switch (this) {
59+
TransactionType.outgoing => dic.sent,
60+
TransactionType.incoming => dic.received,
61+
};
6462
}
6563
}

app/lib/modules/account/view/handle_new_account_result_mixin.dart

+13-17
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,21 @@ mixin HandleNewAccountResultMixin on Widget {
1313
required void Function() onOk,
1414
void Function()? onDuplicateAccount,
1515
}) async {
16-
switch (type) {
17-
case NewAccountResultType.ok:
18-
onOk();
19-
break;
20-
case NewAccountResultType.error:
21-
final dic = I18n.of(context)!.translationsForLocale();
22-
AppAlert.showErrorDialog(context, errorText: dic.account.createError, buttontext: dic.home.ok);
23-
break;
24-
case NewAccountResultType.emptyPassword:
25-
final appStore = context.read<AppStore>();
26-
await AppAlert.showPasswordInputDialog(
16+
final dic = I18n.of(context)!.translationsForLocale();
17+
final appStore = context.read<AppStore>();
18+
return switch (type) {
19+
NewAccountResultType.ok => onOk(),
20+
NewAccountResultType.error => AppAlert.showErrorDialog(
21+
context,
22+
errorText: dic.account.createError,
23+
buttontext: dic.home.ok,
24+
),
25+
NewAccountResultType.emptyPassword => await AppAlert.showPasswordInputDialog(
2726
context,
2827
account: appStore.account.currentAccount,
2928
onSuccess: appStore.settings.setPin,
30-
);
31-
break;
32-
case NewAccountResultType.duplicateAccount:
33-
if (onDuplicateAccount != null) onDuplicateAccount();
34-
break;
35-
}
29+
),
30+
NewAccountResultType.duplicateAccount => onDuplicateAccount != null ? onDuplicateAccount() : null,
31+
};
3632
}
3733
}

app/lib/modules/settings/service/app_service.dart

+8-12
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class AppService {
1515
if (code != null) {
1616
return Locale(code);
1717
} else {
18+
// ignore: deprecated_member_use
1819
final deviceLocal = window.locale.languageCode;
1920
if (deviceLocal == 'en' || deviceLocal == 'de' || deviceLocal == 'ru' || deviceLocal == 'fr') {
2021
return Locale(deviceLocal);
@@ -37,17 +38,12 @@ class AppService {
3738
bool? getIsBiometricAuthenticationEnabled() => storage.getBool(enableBiometricAuthKey);
3839

3940
String getLocaleName(String code) {
40-
switch (code) {
41-
case 'en':
42-
return 'English';
43-
case 'de':
44-
return 'Deutsch';
45-
case 'fr':
46-
return 'Français';
47-
case 'ru':
48-
return 'Русский';
49-
default:
50-
return '';
51-
}
41+
return switch (code) {
42+
'en' => 'English',
43+
'de' => 'Deutsch',
44+
'fr' => 'Français',
45+
'ru' => 'Русский',
46+
_ => '',
47+
};
5248
}
5349
}

app/lib/modules/transfer/view/transfer_history_view.dart

+6-9
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,16 @@ class TransferHistoryView extends StatelessWidget {
2626
style: context.textTheme.displayMedium,
2727
)),
2828
body: Observer(builder: (_) {
29-
switch (transferHistoryStore.fetchStatus) {
30-
case FetchStatus.loading:
31-
return const CenteredActivityIndicator();
32-
case FetchStatus.success:
33-
return TransactionsList(transactions: transferHistoryStore.transactions ?? []);
34-
case FetchStatus.error:
35-
return ErrorView(
29+
return switch (transferHistoryStore.fetchStatus) {
30+
FetchStatus.loading => const CenteredActivityIndicator(),
31+
FetchStatus.success => TransactionsList(transactions: transferHistoryStore.transactions ?? []),
32+
FetchStatus.error => ErrorView(
3633
onRetryPressed: () {
3734
final appStore = context.read<AppStore>();
3835
context.read<TransferHistoryViewStore>().getTransfers(appStore);
3936
},
40-
);
41-
}
37+
),
38+
};
4239
}),
4340
);
4441
}

app/lib/page-encointer/bazaar/1_home/bazaar_search/bazaar_search.dart

-54
This file was deleted.

app/lib/page-encointer/bazaar/1_home/home.dart

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import 'package:flutter/material.dart';
22

3-
import 'package:encointer_wallet/page-encointer/bazaar/1_home/bazaar_search/bazaar_search.dart';
43
import 'package:encointer_wallet/page-encointer/bazaar/shared/bazaar_item_horizontal.dart';
54
import 'package:encointer_wallet/page-encointer/bazaar/shared/data_model/demo_data/demo_data.dart';
65
import 'package:encointer_wallet/utils/translations/index.dart';
@@ -23,7 +22,6 @@ class Home extends StatelessWidget {
2322
HorizontalBazaarItemList(lastVisited, dic.bazaar.lastVisited, cardHeight, cardWidth),
2423
]),
2524
),
26-
const BazaarSearch(),
2725
]);
2826
}
2927
}

app/lib/page-encointer/bazaar/3_businesses/business_detail.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class BusinessDetail extends StatelessWidget {
6161
headingRowHeight: 32,
6262
columnSpacing: 4,
6363
horizontalMargin: 8,
64-
dataRowHeight: 32,
64+
dataRowMinHeight: 32,
6565
rows: List<DataRow>.generate(
6666
7,
6767
(int index) => DataRow(

app/lib/page-encointer/ceremony_box/ceremony_info.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ class CeremonyInfo extends StatelessWidget {
7272
),
7373
],
7474
)
75-
: Row(
75+
: const Row(
7676
mainAxisAlignment: MainAxisAlignment.center,
77-
children: const [
77+
children: [
7878
CupertinoActivityIndicator(),
7979
],
8080
),

app/lib/page/assets/announcement/view/announcement_view.dart

+10-17
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,11 @@ class _AnnouncementViewState extends State<AnnouncementView> {
120120

121121
/// NOTE: Do not write any functions inside [build]!
122122
Widget buildAnnouncementList(List<Announcement> announcements) {
123-
switch (_announcementStore.fetchStatus) {
124-
case FetchStatus.loading:
125-
return const Center(child: CupertinoActivityIndicator());
126-
case FetchStatus.success:
127-
return AnnouncementList(announcements: announcements);
128-
case FetchStatus.error:
129-
return const SizedBox.shrink();
130-
}
123+
return switch (_announcementStore.fetchStatus) {
124+
FetchStatus.loading => const Center(child: CupertinoActivityIndicator()),
125+
FetchStatus.success => AnnouncementList(announcements: announcements),
126+
FetchStatus.error => const SizedBox.shrink(),
127+
};
131128
}
132129

133130
String _getErrorMessages({
@@ -141,15 +138,11 @@ class _AnnouncementViewState extends State<AnnouncementView> {
141138
if (error.isNotNullOrEmpty) {
142139
return '${_dic.announcements} ${_dic.errorMessageWithStatusCode(error!)}';
143140
}
144-
switch (failureType) {
145-
case FailureType.badRequest:
146-
return '${_dic.announcements} ${_dic.badRequest}';
147-
case FailureType.noAuthorization:
148-
return '${_dic.announcements} ${_dic.noAuthorizationError}';
149-
// ignore: no_default_cases
150-
default:
151-
return '${_dic.announcements} ${_dic.somethingWentWrong}';
152-
}
141+
return switch (failureType) {
142+
FailureType.badRequest => '${_dic.announcements} ${_dic.badRequest}',
143+
FailureType.noAuthorization => '${_dic.announcements} ${_dic.noAuthorizationError}',
144+
_ => '${_dic.announcements} ${_dic.somethingWentWrong}',
145+
};
153146
}
154147
}
155148

app/lib/page/assets/transfer/payment_confirmation_page/components/payment_overview.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ class PaymentOverview extends StatelessWidget {
3636
),
3737
],
3838
),
39-
Column(
39+
const Column(
4040
mainAxisAlignment: MainAxisAlignment.center,
41-
children: const [Icon(Icons.arrow_forward_ios_outlined), SizedBox(height: 20)],
41+
children: [Icon(Icons.arrow_forward_ios_outlined), SizedBox(height: 20)],
4242
),
4343
Column(
4444
mainAxisAlignment: MainAxisAlignment.spaceBetween,

0 commit comments

Comments
 (0)