Skip to content

Commit

Permalink
migrate to new version of router, upgrade dependencies (#2)
Browse files Browse the repository at this point in the history
* migrate to new version of router, upgrade dependencies

* updated ci settings
  • Loading branch information
tubopo authored Nov 10, 2023
1 parent f02c97e commit 511e7d4
Show file tree
Hide file tree
Showing 14 changed files with 366 additions and 390 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: "CI [branch]"

on:
push:
branches: [ "main" ]
branches: [ "master" ]
pull_request:
branches: [ "main" ]
branches: [ "master" ]

jobs:
build:
Expand All @@ -14,7 +14,7 @@ jobs:
- uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: "3.7.6"
flutter-version: "3.13.0"
cache: true

- uses: actions/checkout@v3
Expand All @@ -25,7 +25,7 @@ jobs:
- name: Analyze project source
run: |
flutter analyze --fatal-infos
flutter format --set-exit-if-changed .
dart format --set-exit-if-changed .
- name: Run tests
run: flutter test
3 changes: 1 addition & 2 deletions .github/workflows/tag-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: "3.7.6"
flutter-version: "3.13.0"
cache: true

- name: Create Key
Expand Down Expand Up @@ -54,4 +54,3 @@ jobs:
generateReleaseNotes: true
artifacts: build/app/outputs/flutter-apk/app-release.apk
token: ${{ secrets.RELEASE_TOKEN }}

5 changes: 2 additions & 3 deletions lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:provider/provider.dart';
import 'package:sys_dia_log/locale/locales.dart';
import 'package:sys_dia_log/modules/settings/providers/app_settings_provider.dart';
import 'package:sys_dia_log/routing/router.dart';
import 'package:sys_dia_log/routing/app_router.dart';

class SysDiaLogApp extends StatelessWidget {
SysDiaLogApp({Key? key}) : super(key: key);
SysDiaLogApp({super.key});

final _appRouter = AppRouter();

Expand All @@ -20,7 +20,6 @@ class SysDiaLogApp extends StatelessWidget {
),
],
builder: (context, child) => MaterialApp.router(
useInheritedMediaQuery: true,
title: 'Sys Dia Log',
debugShowCheckedModeBanner: false,
theme: ThemeData(
Expand Down
5 changes: 3 additions & 2 deletions lib/modules/home/views/home_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import 'package:sys_dia_log/modules/home/ui/add_new_button.dart';
import 'package:sys_dia_log/modules/home/ui/measurements_list.dart';
import 'package:sys_dia_log/modules/home/ui/refresh_button.dart';
import 'package:sys_dia_log/modules/measurement/models/measurement.dart';
import 'package:sys_dia_log/routing/router.dart';
import 'package:sys_dia_log/routing/app_router.dart';
import 'package:sys_dia_log/shared/ui/loading_indicator.dart';

@RoutePage()
class HomeView extends StatefulWidget {
const HomeView({super.key});

Expand All @@ -28,7 +29,7 @@ class _HomeViewState extends State<HomeView> {
}

_addNavigate() {
context.router.navigate(MeasurementViewRoute(
context.router.navigate(MeasurementRoute(
onAddNewMeasurement: (Measurement m) => setState(() {})));
}

Expand Down
7 changes: 4 additions & 3 deletions lib/modules/measurement/views/measurement_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import 'package:intl/intl.dart';
import 'package:numberpicker/numberpicker.dart';
import 'package:sys_dia_log/modules/measurement/models/measurement.dart';
import 'package:sys_dia_log/modules/measurement/service/measurement_service.dart';
import 'package:sys_dia_log/routing/router.dart';
import 'package:sys_dia_log/routing/app_router.dart';
import 'package:sys_dia_log/shared/ui/snack_bars.dart';

@RoutePage()
class MeasurementView extends StatefulWidget {
final void Function(Measurement)? onAddNewMeasurement;

const MeasurementView({Key? key, this.onAddNewMeasurement}) : super(key: key);
const MeasurementView({super.key, this.onAddNewMeasurement});

@override
State<StatefulWidget> createState() => _MeasurementViewState();
Expand Down Expand Up @@ -41,7 +42,7 @@ class _MeasurementViewState extends State<MeasurementView> {

widget.onAddNewMeasurement?.call(measurement);

AutoRouter.of(context).navigate(const HomeViewRoute());
AutoRouter.of(context).navigate(const HomeRoute());

ScaffoldMessenger.of(context)
..removeCurrentSnackBar()
Expand Down
4 changes: 3 additions & 1 deletion lib/modules/settings/views/settings_view.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_i18n/widgets/I18nText.dart';
import 'package:sys_dia_log/modules/settings/ui/locale_settings.dart';
import 'package:sys_dia_log/modules/settings/ui/theme_settings.dart';

@RoutePage()
class SettingsView extends StatelessWidget {
const SettingsView({Key? key}) : super(key: key);
const SettingsView({super.key});

@override
Widget build(BuildContext context) {
Expand Down
26 changes: 26 additions & 0 deletions lib/routing/app_router.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:sys_dia_log/modules/home/views/home_view.dart';
import 'package:sys_dia_log/modules/measurement/models/measurement.dart';
import 'package:sys_dia_log/modules/measurement/views/measurement_view.dart';
import 'package:sys_dia_log/modules/settings/views/settings_view.dart';
import 'package:sys_dia_log/shared/views/nav_bar_view.dart';
import 'package:sys_dia_log/shared/views/splash_screen_view.dart';

part 'app_router.gr.dart';

@AutoRouterConfig(replaceInRouteName: 'View,Route')
class AppRouter extends _$AppRouter {
@override
RouteType get defaultRouteType => const RouteType.material();

@override
List<AutoRoute> get routes => [
AutoRoute(page: SplashScreenRoute.page, initial: true),
CustomRoute(page: NavBarRoute.page, children: [
AutoRoute(page: HomeRoute.page),
AutoRoute(page: MeasurementRoute.page),
AutoRoute(page: SettingsRoute.page)
]),
];
}
148 changes: 148 additions & 0 deletions lib/routing/app_router.gr.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 0 additions & 26 deletions lib/routing/router.dart

This file was deleted.

Loading

0 comments on commit 511e7d4

Please sign in to comment.