Riverpod + go_router с auth-guard, NavigationRail на широком экране и bottom bar на узком. Токены в flutter_secure_storage, на web access живёт в памяти. Интерцептор подставляет токен и делает ровно один refresh на 401. Деньги приходят строками и форматируются через Decimal: парсить их в double значило бы терять копейки ровно там, где бэкенд их бережёт.
27 lines
854 B
Dart
27 lines
854 B
Dart
import 'package:fintracker_app/features/shell/app_shell.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
void main() {
|
|
Widget wrap(double width) {
|
|
return MediaQuery(
|
|
data: MediaQueryData(size: Size(width, 800)),
|
|
child: MaterialApp(
|
|
home: AppShell(location: '/', child: Container()),
|
|
),
|
|
);
|
|
}
|
|
|
|
testWidgets('shows a NavigationRail on a wide surface', (tester) async {
|
|
await tester.pumpWidget(wrap(1280));
|
|
expect(find.byType(NavigationRail), findsOneWidget);
|
|
expect(find.byType(NavigationBar), findsNothing);
|
|
});
|
|
|
|
testWidgets('shows a bottom NavigationBar on a narrow surface', (tester) async {
|
|
await tester.pumpWidget(wrap(400));
|
|
expect(find.byType(NavigationBar), findsOneWidget);
|
|
expect(find.byType(NavigationRail), findsNothing);
|
|
});
|
|
}
|