Visual pass toward docs/mockups (06 inventory, 07 item): - Bundle the seedks icon font (chars a–k → seed pictograms: jar, packet, spoon…) and a SeedGlyph/QuantityKindIcon helper. - Green app bar + pale-green canvas theme (buildTaneTheme). - Inventory list: rounded-square photo thumbnail or green initial avatar, bold title, scientific-name subtitle, trailing edit pencil, styled category headers, rounded search field, seed-glyph empty state. - Quantity selectors (quick-add + add-lot) show the seed pictogram + word; detail lot lines use the kind's glyph. - Detail header restyled to mockup 07: category link + scientific name on the left, photo on the right. watchInventory now also returns the linked species' scientific name (subtitle). 37 app tests green; seedks font verified in the Linux asset bundle.
70 lines
2.3 KiB
Dart
70 lines
2.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
import 'data/species_repository.dart';
|
|
import 'data/variety_repository.dart';
|
|
import 'i18n/strings.g.dart';
|
|
import 'state/inventory_cubit.dart';
|
|
import 'state/variety_detail_cubit.dart';
|
|
import 'ui/inventory_list_screen.dart';
|
|
import 'ui/theme.dart';
|
|
import 'ui/variety_detail_screen.dart';
|
|
|
|
/// Root widget. Provides the repository + inventory cubit to the tree and wires
|
|
/// go_router. The list is `/`; `/variety/:id` is a placeholder detail route
|
|
/// (the full item screen is a follow-on story).
|
|
class TaneApp extends StatelessWidget {
|
|
TaneApp({required this.repository, required this.species, super.key})
|
|
: _router = _buildRouter(repository);
|
|
|
|
final VarietyRepository repository;
|
|
final SpeciesRepository species;
|
|
final GoRouter _router;
|
|
|
|
static GoRouter _buildRouter(VarietyRepository repository) {
|
|
return GoRouter(
|
|
routes: [
|
|
GoRoute(
|
|
path: '/',
|
|
builder: (context, state) => BlocProvider(
|
|
create: (_) => InventoryCubit(repository),
|
|
child: const InventoryListScreen(),
|
|
),
|
|
),
|
|
GoRoute(
|
|
path: '/variety/:id',
|
|
builder: (context, state) => BlocProvider(
|
|
create: (_) =>
|
|
VarietyDetailCubit(repository, state.pathParameters['id']!),
|
|
child: const VarietyDetailScreen(),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MultiRepositoryProvider(
|
|
providers: [
|
|
RepositoryProvider.value(value: repository),
|
|
RepositoryProvider.value(value: species),
|
|
],
|
|
child: MaterialApp.router(
|
|
onGenerateTitle: (context) => context.t.app.title,
|
|
debugShowCheckedModeBanner: false,
|
|
theme: buildTaneTheme(),
|
|
locale: TranslationProvider.of(context).flutterLocale,
|
|
supportedLocales: AppLocaleUtils.supportedLocales,
|
|
localizationsDelegates: const [
|
|
GlobalMaterialLocalizations.delegate,
|
|
GlobalWidgetsLocalizations.delegate,
|
|
GlobalCupertinoLocalizations.delegate,
|
|
],
|
|
routerConfig: _router,
|
|
),
|
|
);
|
|
}
|
|
}
|