Upgrade to Flutter 3
This commit is contained in:
parent
9d2871405d
commit
1f48e868b0
8 changed files with 530 additions and 258 deletions
|
@ -1,4 +1,3 @@
|
|||
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:info_tren/components/select_train_suggestions/select_train_suggestions_cupertino.dart';
|
||||
|
@ -6,7 +5,6 @@ import 'package:info_tren/components/select_train_suggestions/select_train_sugge
|
|||
import 'package:info_tren/components/select_train_suggestions/select_train_suggestions_material.dart';
|
||||
import 'package:info_tren/models.dart';
|
||||
import 'package:info_tren/providers.dart';
|
||||
import 'package:info_tren/utils/default_ui_design.dart';
|
||||
|
||||
class SelectTrainSuggestions extends ConsumerWidget {
|
||||
final List<TrainsResult> choices;
|
||||
|
|
|
@ -44,7 +44,7 @@ class SlimAppBar extends StatelessWidget {
|
|||
title,
|
||||
textAlign: TextAlign.center,
|
||||
style:
|
||||
Theme.of(context).appBarTheme.textTheme?.bodySmall?.copyWith(color: Theme.of(context).appBarTheme.textTheme?.bodyMedium?.color) ??
|
||||
Theme.of(context).textTheme.titleSmall?.copyWith(color: Theme.of(context).textTheme.titleLarge?.color) ??
|
||||
Theme.of(context).textTheme.bodySmall?.copyWith(color: Theme.of(context).textTheme.bodyMedium?.color),
|
||||
),
|
||||
),
|
||||
|
|
108
lib/main.dart
108
lib/main.dart
|
@ -1,5 +1,6 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:dynamic_color/dynamic_color.dart';
|
||||
import 'package:fluent_ui/fluent_ui.dart' as f;
|
||||
import 'package:flutter/cupertino.dart' as c;
|
||||
import 'package:flutter/gestures.dart';
|
||||
|
@ -20,6 +21,7 @@ import 'package:shared_preferences/shared_preferences.dart';
|
|||
import 'package:timezone/data/latest.dart';
|
||||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
initializeTimeZones();
|
||||
final sharedPreferences = await SharedPreferences.getInstance();
|
||||
runApp(
|
||||
|
@ -107,52 +109,82 @@ class StartPoint extends ConsumerWidget {
|
|||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final uiDesign = ref.watch(uiDesignProvider);
|
||||
if (uiDesign == UiDesign.CUPERTINO) {
|
||||
return AnnotatedRegion(
|
||||
value: const SystemUiOverlayStyle(
|
||||
statusBarBrightness: c.Brightness.dark,
|
||||
),
|
||||
child: c.CupertinoApp(
|
||||
title: appTitle,
|
||||
theme: c.CupertinoThemeData(
|
||||
primaryColor: m.Colors.blue.shade600,
|
||||
brightness: c.Brightness.dark,
|
||||
// textTheme: CupertinoTextThemeData(
|
||||
// textStyle: TextStyle(
|
||||
// fontFamily: 'Atkinson Hyperlegible',
|
||||
// ),
|
||||
// ),
|
||||
),
|
||||
scrollBehavior: Platform.isLinux ? const DragCupertinoScrollBevahior() : null,
|
||||
routes: routes,
|
||||
),
|
||||
return DynamicColorBuilder(
|
||||
builder: (lightScheme, darkScheme) {
|
||||
return AnnotatedRegion(
|
||||
value: const SystemUiOverlayStyle(
|
||||
statusBarBrightness: c.Brightness.dark,
|
||||
),
|
||||
child: c.CupertinoApp(
|
||||
title: appTitle,
|
||||
theme: c.CupertinoThemeData(
|
||||
primaryColor: darkScheme?.primary ?? m.Colors.blue.shade600,
|
||||
brightness: c.Brightness.dark,
|
||||
// textTheme: CupertinoTextThemeData(
|
||||
// textStyle: TextStyle(
|
||||
// fontFamily: 'Atkinson Hyperlegible',
|
||||
// ),
|
||||
// ),
|
||||
),
|
||||
scrollBehavior: Platform.isLinux ? const DragCupertinoScrollBevahior() : null,
|
||||
routes: routes,
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
else if (uiDesign == UiDesign.FLUENT) {
|
||||
return f.FluentApp(
|
||||
title: appTitle,
|
||||
theme: f.ThemeData(
|
||||
brightness: f.Brightness.dark,
|
||||
accentColor: f.Colors.blue,
|
||||
),
|
||||
routes: routes,
|
||||
scrollBehavior: Platform.isLinux ? const DragFluentScrollBevahior() : const f.FluentScrollBehavior(),
|
||||
return DynamicColorBuilder(
|
||||
builder: (lightScheme, darkScheme) {
|
||||
return f.FluentApp(
|
||||
title: appTitle,
|
||||
theme: f.FluentThemeData(
|
||||
brightness: f.Brightness.light,
|
||||
accentColor: lightScheme != null ? f.AccentColor.swatch({
|
||||
'normal': lightScheme.primary,
|
||||
}) : f.Colors.blue,
|
||||
),
|
||||
darkTheme: f.FluentThemeData(
|
||||
brightness: f.Brightness.dark,
|
||||
accentColor: darkScheme != null ? f.AccentColor.swatch({
|
||||
'normal': darkScheme.primary,
|
||||
}) : f.Colors.blue,
|
||||
),
|
||||
routes: routes,
|
||||
scrollBehavior: Platform.isLinux ? const DragFluentScrollBevahior() : const f.FluentScrollBehavior(),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
else {
|
||||
return m.MaterialApp(
|
||||
title: appTitle,
|
||||
theme: m.ThemeData(
|
||||
primarySwatch: m.Colors.blue,
|
||||
colorScheme: m.ColorScheme.fromSwatch(
|
||||
return DynamicColorBuilder(
|
||||
builder: (lightScheme, darkScheme) {
|
||||
lightScheme ??= m.ColorScheme.fromSwatch(
|
||||
brightness: m.Brightness.light,
|
||||
primarySwatch: m.Colors.blue,
|
||||
);
|
||||
darkScheme ??= m.ColorScheme.fromSwatch(
|
||||
brightness: m.Brightness.dark,
|
||||
primarySwatch: m.Colors.blue,
|
||||
accentColor: m.Colors.blue.shade700,
|
||||
),
|
||||
useMaterial3: true,
|
||||
// fontFamily: 'Atkinson Hyperlegible',
|
||||
),
|
||||
scrollBehavior: Platform.isLinux ? const DragMaterialScrollBevahior() : null,
|
||||
routes: routes,
|
||||
);
|
||||
|
||||
|
||||
return m.MaterialApp(
|
||||
title: appTitle,
|
||||
theme: m.ThemeData(
|
||||
colorScheme: lightScheme,
|
||||
useMaterial3: true,
|
||||
// fontFamily: 'Atkinson Hyperlegible',
|
||||
),
|
||||
darkTheme: m.ThemeData(
|
||||
colorScheme: darkScheme,
|
||||
useMaterial3: true,
|
||||
// fontFamily: 'Atkinson Hyperlegible',
|
||||
),
|
||||
scrollBehavior: Platform.isLinux ? const DragMaterialScrollBevahior() : null,
|
||||
routes: routes,
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:info_tren/components/cupertino_listtile.dart';
|
||||
import 'package:info_tren/models.dart';
|
||||
import 'package:info_tren/pages/settings/setings_page.dart';
|
||||
import 'package:info_tren/providers.dart';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import 'dart:math';
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/material.dart' hide Badge;
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:info_tren/components/badge/badge.dart';
|
||||
import 'package:info_tren/components/loading/loading.dart';
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
import 'package:info_tren/models.dart';
|
||||
|
||||
String stateToString(TrainDataState state) {
|
||||
switch(state) {
|
||||
case TrainDataState.PASSING:
|
||||
return 'trecere fără oprire';
|
||||
case TrainDataState.ARRIVAL:
|
||||
return 'sosire';
|
||||
case TrainDataState.DEPARTURE:
|
||||
return 'plecare';
|
||||
}
|
||||
}
|
||||
String stateToString(TrainDataState state) => switch (state) {
|
||||
TrainDataState.passing => 'trecere fără oprire',
|
||||
TrainDataState.arrival => 'sosire',
|
||||
TrainDataState.departure => 'plecare',
|
||||
};
|
||||
|
|
646
pubspec.lock
646
pubspec.lock
File diff suppressed because it is too large
Load diff
12
pubspec.yaml
12
pubspec.yaml
|
@ -14,7 +14,7 @@ description: O aplicație de vizualizare a datelor puse la dispoziție de Inform
|
|||
version: 2.7.10
|
||||
|
||||
environment:
|
||||
sdk: ">=2.17.0 <3.0.0"
|
||||
sdk: ">=3.0.0 <4.0.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
|
@ -30,19 +30,23 @@ dependencies:
|
|||
url_launcher: ^6.1.5
|
||||
flutter_hooks: ^0.18.5+1
|
||||
hooks_riverpod: ^2.0.2
|
||||
freezed_annotation: ^2.2.0
|
||||
json_annotation: ^4.7.0
|
||||
freezed_annotation: ^2.4.1
|
||||
json_annotation: ^4.8.1
|
||||
shared_preferences: ^2.0.15
|
||||
fluent_ui: ^4.0.3+1
|
||||
timezone: ^0.9.0
|
||||
dynamic_color: ^1.6.6
|
||||
riverpod_annotation: ^2.1.1
|
||||
|
||||
dev_dependencies:
|
||||
# flutter_test:
|
||||
# sdk: flutter
|
||||
build_runner: ^2.1.0
|
||||
json_serializable: ^6.5.4
|
||||
freezed: 2.2.0
|
||||
freezed: ^2.4.1
|
||||
flutter_lints: ^2.0.1
|
||||
riverpod_lint: ^1.3.2
|
||||
riverpod_generator: ^2.2.3
|
||||
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
|
|
Loading…
Add table
Reference in a new issue