Line data Source code
1 : import 'package:flutter/material.dart';
2 : import 'package:nav/nav.dart';
3 :
4 : class NavAppForTesting extends StatefulWidget {
5 : final Widget child;
6 9 : static final globalNavigatorKey = GlobalKey<NavigatorState>();
7 :
8 3 : const NavAppForTesting({super.key, required this.child});
9 :
10 3 : @override
11 3 : State<NavAppForTesting> createState() => _NavAppForTestingState();
12 : }
13 :
14 : class _NavAppForTestingState extends State<NavAppForTesting> with Nav {
15 3 : @override
16 : Widget build(BuildContext context) {
17 3 : return MaterialApp(
18 6 : home: widget.child,
19 3 : navigatorKey: navigatorKey,
20 : );
21 : }
22 :
23 3 : @override
24 : GlobalKey<NavigatorState> get navigatorKey =>
25 3 : NavAppForTesting.globalNavigatorKey;
26 : }
|