All checks were successful
Build and deploy Flutter Web / build (push) Successful in 2m48s
102 lines
3.2 KiB
Dart
102 lines
3.2 KiB
Dart
import 'package:flutter/gestures.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
import 'auth/telegram_session.dart' as telegram_session;
|
|
import 'screens/mapflow_shell.dart';
|
|
|
|
void main() {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
telegram_session.configureTelegramWebApp();
|
|
runApp(const ProviderScope(child: MapflowApp()));
|
|
}
|
|
|
|
class MapflowApp extends StatelessWidget {
|
|
const MapflowApp({super.key});
|
|
|
|
ThemeData _buildTheme() {
|
|
final colorScheme = ColorScheme.fromSeed(
|
|
seedColor: const Color(0xFF0F766E),
|
|
primary: const Color(0xFF0F766E),
|
|
secondary: const Color(0xFFE11D48),
|
|
surface: const Color(0xFFFFFBF5),
|
|
);
|
|
|
|
return ThemeData(
|
|
useMaterial3: true,
|
|
colorScheme: colorScheme,
|
|
scaffoldBackgroundColor: const Color(0xFFF7F3EA),
|
|
fontFamily: 'SF Pro Display',
|
|
appBarTheme: const AppBarTheme(
|
|
backgroundColor: Color(0xFFF7F3EA),
|
|
foregroundColor: Color(0xFF17211D),
|
|
surfaceTintColor: Colors.transparent,
|
|
),
|
|
cardTheme: CardThemeData(
|
|
elevation: 0,
|
|
color: const Color(0xFFFFFBF5),
|
|
surfaceTintColor: Colors.transparent,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(8),
|
|
side: const BorderSide(color: Color(0xFFE0D8CA)),
|
|
),
|
|
),
|
|
chipTheme: const ChipThemeData(
|
|
shape: StadiumBorder(side: BorderSide(color: Color(0xFFE0D8CA))),
|
|
),
|
|
inputDecorationTheme: InputDecorationTheme(
|
|
filled: true,
|
|
fillColor: const Color(0xFFFFFFFF),
|
|
border: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(8),
|
|
borderSide: const BorderSide(color: Color(0xFFD8D0C3)),
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(8),
|
|
borderSide: const BorderSide(color: Color(0xFFD8D0C3)),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(8),
|
|
borderSide: BorderSide(color: colorScheme.primary, width: 1.5),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final shortcuts =
|
|
Map<ShortcutActivator, Intent>.of(WidgetsApp.defaultShortcuts)
|
|
..[const SingleActivator(LogicalKeyboardKey.tab)] =
|
|
const NextFocusIntent()
|
|
..[const SingleActivator(LogicalKeyboardKey.tab, shift: true)] =
|
|
const PreviousFocusIntent();
|
|
|
|
return MaterialApp(
|
|
title: 'MapFlow',
|
|
debugShowCheckedModeBanner: false,
|
|
scrollBehavior: const MaterialScrollBehavior().copyWith(
|
|
scrollbars: true,
|
|
dragDevices: {
|
|
PointerDeviceKind.touch,
|
|
PointerDeviceKind.mouse,
|
|
PointerDeviceKind.trackpad,
|
|
PointerDeviceKind.stylus,
|
|
},
|
|
),
|
|
theme: _buildTheme(),
|
|
builder: (context, child) {
|
|
return Shortcuts(
|
|
shortcuts: shortcuts,
|
|
child: FocusTraversalGroup(
|
|
policy: ReadingOrderTraversalPolicy(),
|
|
child: child ?? const SizedBox.shrink(),
|
|
),
|
|
);
|
|
},
|
|
home: const MapflowShell(),
|
|
);
|
|
}
|
|
}
|