Last active
March 21, 2023 08:13
-
-
Save yuki2021/fcaf4fe5cde69d7ebeda5da772d95387 to your computer and use it in GitHub Desktop.
FlutterのWidgetテストで画面遷移をするときのSetup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
late Widget testWidget; | |
final appRouter = AppRouter(); | |
// 読み込み時に実行 | |
setUp(() { | |
testWidget = ProviderScope( | |
child: MediaQuery( | |
data: MediaQueryData(), | |
child: ScreenUtilInit( | |
designSize: const Size(375, 812), | |
minTextAdapt: true, | |
builder: (context, child) { | |
return MaterialApp.router( | |
builder: (context, child) { | |
return Scaffold( | |
body: child, | |
); | |
}, | |
routerDelegate: appRouter.delegate( | |
initialRoutes: [const ApplyStepFirstRoute()], | |
), | |
routeInformationParser: appRouter.defaultRouteParser(), | |
); | |
}, | |
), | |
), | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment