Open SeifAlmoatazBellah opened 2 years ago
有解决吗
How to deal with it?
Instatiate your handler function like this:
var usersHandler = Handler( handlerFunc: (BuildContext? context, Map<String, dynamic> params) { return AuthWrapper(); }, );
You need to allow BuildContext to be null to actually match the right parameter for the constructor of Handler. So use BuildContext? context
Instatiate your handler function like this:
var usersHandler = Handler( handlerFunc: (BuildContext? context, Map<String, dynamic> params) { return AuthWrapper(); }, );
You need to allow BuildContext to be null to actually match the right parameter for the constructor of Handler. So use BuildContext? context
Thank you
Hello i have an error with Fluro when i set handlerFunc this is my codes: ` class AppRouter { static final router = FluroRouter();
var usersHandler = Handler( handlerFunc: (BuildContext context, Map<String, dynamic> params) { return AuthWrapper(); }, );
void defineRoutes(FluroRouter router) { router.define("/auth", handler: usersHandler); } }
AuthWrapper screen:
class AuthWrapper extends StatefulWidget { const AuthWrapper({Key? key}) : super(key: key);@override _AuthWrapperState createState() => _AuthWrapperState(); }
class _AuthWrapperState extends State {
bool loading = false;
@override Widget build(BuildContext context) { ThemeSetting theme = Provider.of(context);
return AnnotatedRegion(
value: SystemUiOverlayStyle(
statusBarIconBrightness: Brightness.light,
statusBarColor: Colors.transparent,
systemNavigationBarIconBrightness: Brightness.light,
systemNavigationBarColor: Colors.transparent,
),
child: loading
? Scaffold(
backgroundColor: theme.primary,
body: Center(
child: LoadingWidget(),
),
)
: Scaffold(
backgroundColor: theme.primary,
bottomNavigationBar: BottomAppBar(
elevation: 0,
color: Colors.transparent,
child: TabBar(
labelColor: theme.secondary,
unselectedLabelColor: theme.secondary.withOpacity(.8),
indicatorColor: theme.secondary,
tabs: [
Tab(text: 'SignIn'),
Tab(text: 'SignUp'),
],
),
),
body: TabBarView(
children: [
SignUp(),
SignIn(),
],
),
),
);
}
}
`