Adds a one-time download flow for the on-device Gemma 2B model (~1.1 GB) with a progress bar, partial-download cleanup, and automatic navigation to the app shell once the file is verified. App.dart now gates on modelPresentProvider instead of onboarding state.
47 lines
1.3 KiB
Dart
47 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'core/providers/model_download_provider.dart';
|
|
import 'features/model_download/model_download_screen.dart';
|
|
import 'shell.dart';
|
|
|
|
class App extends ConsumerWidget {
|
|
const App({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
final modelPresentAsync = ref.watch(modelPresentProvider);
|
|
|
|
return MaterialApp(
|
|
title: 'DailyYou',
|
|
debugShowCheckedModeBanner: false,
|
|
theme: _lightTheme(),
|
|
darkTheme: _darkTheme(),
|
|
themeMode: ThemeMode.system,
|
|
home: modelPresentAsync.when(
|
|
data: (present) =>
|
|
present ? const AppShell() : const ModelDownloadScreen(),
|
|
loading: () => const Scaffold(
|
|
body: Center(child: CircularProgressIndicator()),
|
|
),
|
|
error: (_, __) => const ModelDownloadScreen(),
|
|
),
|
|
);
|
|
}
|
|
|
|
ThemeData _lightTheme() => ThemeData(
|
|
useMaterial3: true,
|
|
colorScheme: ColorScheme.fromSeed(
|
|
seedColor: const Color(0xFF6B8CFF),
|
|
brightness: Brightness.light,
|
|
),
|
|
);
|
|
|
|
ThemeData _darkTheme() => ThemeData(
|
|
useMaterial3: true,
|
|
colorScheme: ColorScheme.fromSeed(
|
|
seedColor: const Color(0xFF6B8CFF),
|
|
brightness: Brightness.dark,
|
|
),
|
|
);
|
|
}
|