Open lil5 opened 3 years ago
To read and understand how fluro work I have needed to read 5+ files. Meanwhile having implemented fluro into my project only using 2 files for route initialization.
Might I suggest something like this?
// /main.dart import 'package:flutter/material.dart'; import 'app/router.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatefulWidget { const MyApp({Key? key}) : super(key: key); @override _MyApp createState() => _MyApp(); } class _MyApp extends State<MyApp> { final router = Routes.getRouter(); // render @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', initialRoute: '/', onGenerateRoute: router.generator, ); } }
// /app/router.dart import 'package:fluro/fluro.dart'; class Routes { static FluroRouter getRouter() { final router = FluroRouter(); router.define( "/", handler: Handler(handlerFunc: (context, params) => const HomePage()), ); router.define( "/chat", handler: Handler(handlerFunc: (context, params) => const SecondPage()), transitionType: TransitionType.fadeIn, ); return router; } }
I'm actually gonna use this to try out the package
@lukepighetti Would you be interested in receiving a Pull Request replacing or adding this example?
If so I will try to make the time to create one.
To read and understand how fluro work I have needed to read 5+ files. Meanwhile having implemented fluro into my project only using 2 files for route initialization.
Might I suggest something like this?