feat: add model download screen and gate app on model presence
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.
This commit is contained in:
+7
-5
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'core/providers/settings_provider.dart';
|
||||
import 'core/providers/model_download_provider.dart';
|
||||
import 'features/model_download/model_download_screen.dart';
|
||||
import 'shell.dart';
|
||||
|
||||
class App extends ConsumerWidget {
|
||||
@@ -8,7 +9,7 @@ class App extends ConsumerWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final onboardingAsync = ref.watch(isOnboardingCompleteProvider);
|
||||
final modelPresentAsync = ref.watch(modelPresentProvider);
|
||||
|
||||
return MaterialApp(
|
||||
title: 'DailyYou',
|
||||
@@ -16,12 +17,13 @@ class App extends ConsumerWidget {
|
||||
theme: _lightTheme(),
|
||||
darkTheme: _darkTheme(),
|
||||
themeMode: ThemeMode.system,
|
||||
home: onboardingAsync.when(
|
||||
data: (complete) => const AppShell(),
|
||||
home: modelPresentAsync.when(
|
||||
data: (present) =>
|
||||
present ? const AppShell() : const ModelDownloadScreen(),
|
||||
loading: () => const Scaffold(
|
||||
body: Center(child: CircularProgressIndicator()),
|
||||
),
|
||||
error: (e, _) => const AppShell(),
|
||||
error: (_, __) => const ModelDownloadScreen(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user