Skip to content

Instantly share code, notes, and snippets.

@yuki2021
Last active March 21, 2023 08:13
Show Gist options
  • Save yuki2021/fcaf4fe5cde69d7ebeda5da772d95387 to your computer and use it in GitHub Desktop.
Save yuki2021/fcaf4fe5cde69d7ebeda5da772d95387 to your computer and use it in GitHub Desktop.
FlutterのWidgetテストで画面遷移をするときのSetup
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