Skip to content

Commit

Permalink
Feature: Migration to Flutter 3.16.9 (#13)
Browse files Browse the repository at this point in the history
This branch introduces Flutter version upgrade from "3.13.6" (Dart 3.1.3) to "3.16.9" (Dart 3.2.6). This change was made to unify the version of Flutter/Dart used between projects.

List of changes:
- upgraded Flutter version from "3.13.6" (Dart 3.1.3) to "3.16.9" (Dart 3.2.6)
- upgraded packages version to the highest versions compatible with Flutter 3.16.9
- updated deprecated links and information about used Flutter version and in README.md
- changed Flutter version in deploy.sh
- added "useMaterial3: false" to theme_config.dart, kira_tab_bar.dart, as Material 3 redesigned some widgets used by miro which caused UI issues
- replaced WillPopScope -> PopScope within the application, as WillPopScope is deprecated since Flutter 3.12.0
- increased popup size in date_range_dropdown_pop_menu.dart, pop_wrapper_mobile.dart, because date_range_dropdown_pop_menu.dart had an overflow issue
- removed ranged constraints from the packages version, Flutter version and Dart version in pubspec.yaml to guarantee the use of their tested and verified version
- added pubspec.lock files to .gitignore
- unrelated with the branch specific domain: removed Future from globalLocator initialization in locator.dart. None of the methods in this file are asynchronous, making the use of Future unnecessary
  • Loading branch information
dpajak99 authored Aug 22, 2024
1 parent c664da1 commit a1bdd61
Show file tree
Hide file tree
Showing 15 changed files with 79 additions and 1,354 deletions.
2 changes: 1 addition & 1 deletion .fvm/fvm_config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"flutterSdkVersion": "3.13.6",
"flutterSdkVersion": "3.16.9",
"flavors": {}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

# Miscellaneous
*.class
*.lock
*.log
*.pyc
*.swp
Expand Down
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
# miro

Miro is user interface for KIRA Network to manage accounts, balance and transfer tokens between different wallets.

## Installation

Use git clone to download [miro](https://github.com/KiraCore/miro) project.

```bash
git clone [email protected]:KiraCore/miro.git
```

## Usage
The project runs on flutter version **3.13.6**. You can use [fvm](https://fvm.app/docs/getting_started/installation)

The project runs on flutter version **3.16.9**. You can
use [fvm](https://fvm.app/documentation/getting-started/installation)
for easy switching between versions

```bash
# Install and use required flutter version
fvm install 3.13.6
fvm use 3.13.6
fvm install 3.16.9
fvm use 3.16.9

# Install required packages in pubspec.yaml
fvm flutter pub get
Expand All @@ -25,9 +31,11 @@ fvm flutter run -d web-server
```

To generate config files use

```bash
fvm flutter pub run build_runner
```

```bash
# Built-in Commands
# - build: Runs a single build and exits.
Expand All @@ -43,7 +51,9 @@ fvm flutter pub run build_runner watch --delete-conflicting-outputs
```

## Tests

To run Unit Tests / Integration tests

```bash
# Run all Unit Tests
fvm flutter test test/unit --platform chrome --null-assertions
Expand All @@ -59,13 +69,15 @@ fvm flutter test test/unit/infra/services/api_kira/query_execution_fee_service_t
```

## Building, Deploying and Installing

To build project please run script in [deploy.sh](https://github.com/KiraCore/miro/deploy.sh). \
Deploy script is only intended to be run on Ubuntu 20.04.4 LTS.\
After successful build, open index.html in "/miro/build/web".\
Enjoy!
Enjoy!

## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what would like to improve. Please

Pull requests are welcome. For major changes, please open an issue first to discuss what would like to improve. Please
make sure to update tests as well.

## [Licence](./LICENSE.md)
2 changes: 1 addition & 1 deletion lib/config/locator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import 'package:miro/shared/controllers/global_nav/global_nav_controller.dart';

final GetIt globalLocator = GetIt.I;

Future<void> initLocator() async {
void initLocator() {
globalLocator
..registerLazySingleton<AppConfig>(AppConfig.buildDefaultConfig)
..registerLazySingleton<ICacheManager>(AutoCacheManager.new);
Expand Down
2 changes: 1 addition & 1 deletion lib/config/theme/theme_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:miro/config/theme/design_colors.dart';

class ThemeConfig {
static ThemeData buildTheme({required bool isSmallScreen}) {
final ThemeData themeData = ThemeData.dark();
final ThemeData themeData = ThemeData.dark(useMaterial3: false);

return themeData.copyWith(
colorScheme: const ColorScheme.dark(background: DesignColors.background),
Expand Down
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Future<void> main() async {
// disable default context menu
window.document.onContextMenu.listen((MouseEvent mouseEvent) => mouseEvent.preventDefault());

await initLocator();
initLocator();
await globalLocator<ICacheManager>().init();

Map<String, dynamic> configJson = await AssetsManager().getAsMap('assets/network_list_config.json');
Expand Down
2 changes: 1 addition & 1 deletion lib/test/utils/test_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class TestUtils {
}

static Future<void> initIntegrationTest() async {
await initLocator();
initLocator();
await globalLocator<ICacheManager>().init();
globalLocator<AppConfig>().init(MockNetworkListConfigJson.defaultNetworkListConfig);
}
Expand Down
7 changes: 3 additions & 4 deletions lib/views/layout/drawer/kira_drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class _KiraDrawer extends State<KiraDrawer> {
Widget build(BuildContext context) {
return GestureDetector(
onTap: () => _handleDrawerShadowTap(context),
child: WillPopScope(
onWillPop: _onWillPop,
child: PopScope(
onPopInvoked: (_) => _handlePopInvoked(),
child: SizedBox(
width: widget.width,
height: MediaQuery.of(context).size.height,
Expand Down Expand Up @@ -72,14 +72,13 @@ class _KiraDrawer extends State<KiraDrawer> {
}
}

Future<bool> _onWillPop() async {
Future<void> _handlePopInvoked() async {
bool canPop = drawerCubit.canPop;
if (canPop) {
_handleDrawerPop();
} else {
_handleDrawerClose();
}
return Future<bool>.value(canPop);
}

void _handleDrawerPop() {
Expand Down
9 changes: 4 additions & 5 deletions lib/views/layout/scaffold/backdrop/backdrop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ class _Backdrop extends State<Backdrop> with SingleTickerProviderStateMixin {

@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () => _handleTryPop(context),
return PopScope(
canPop: _isExpanded,
onPopInvoked: (_) => _handlePopInvoked(context),
child: Column(
children: <Widget>[
AnimatedBuilder(
Expand Down Expand Up @@ -89,12 +90,10 @@ class _Backdrop extends State<Backdrop> with SingleTickerProviderStateMixin {
}
}

Future<bool> _handleTryPop(BuildContext context) async {
Future<void> _handlePopInvoked(BuildContext context) async {
if (_isExpanded) {
collapse();
return false;
}
return true;
}

bool get _isCollapsed => _collapsedAnimationStatusList.contains(animationController.status);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class _DateRangeDropdownPopMenu extends State<DateRangeDropdownPopMenu> {

return Container(
padding: const EdgeInsets.symmetric(vertical: 16),
width: 250,
width: 310,
height: 440,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class _PopWrapperMobile extends State<PopWrapperMobile> {
),
backgroundColor: themeData.scaffoldBackgroundColor,
child: Container(
constraints: const BoxConstraints(maxWidth: 200),
constraints: const BoxConstraints(maxWidth: 310),
decoration: BoxDecoration(
color: widget.backgroundColor,
borderRadius: BorderRadius.circular(8),
Expand Down
2 changes: 1 addition & 1 deletion lib/views/widgets/kira/kira_tab_bar/kira_tab_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class KiraTabBar extends StatelessWidget {
TextTheme textTheme = Theme.of(context).textTheme;

return Theme(
data: ThemeData().copyWith(
data: ThemeData(useMaterial3: false).copyWith(
splashColor: Colors.transparent,
highlightColor: Colors.transparent,
splashFactory: NoSplash.splashFactory,
Expand Down
Loading

0 comments on commit a1bdd61

Please sign in to comment.