ff_annotation_route 6.0.0-non-null-safety copy "ff_annotation_route: ^6.0.0-non-null-safety" to clipboard
ff_annotation_route: ^6.0.0-non-null-safety copied to clipboard

outdated

Provide a route generator to create route map quickly by annotations.

example/lib/main.dart

import 'package:ff_annotation_route_library/ff_annotation_route_library.dart';
import 'package:flutter/material.dart';
import 'example_route.dart';
import 'example_routes.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'ff_annotation_route demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      initialRoute: Routes.fluttercandiesMainpage,
      onGenerateRoute: (RouteSettings settings) {
        return onGenerateRoute(
          settings: settings,
          getRouteSettings: getRouteSettings,
          routeSettingsWrapper: (FFRouteSettings ffRouteSettings) {
            if (ffRouteSettings.name == Routes.fluttercandiesMainpage ||
                ffRouteSettings.name ==
                    Routes.fluttercandiesDemogrouppage.name) {
              return ffRouteSettings;
            }
            return ffRouteSettings.copyWith(
                widget: CommonWidget(
              child: ffRouteSettings.widget,
              title: ffRouteSettings.routeName,
            ));
          },
        );
      },
    );
  }
}

class CommonWidget extends StatelessWidget {
  const CommonWidget({
    this.child,
    this.title,
  });
  final Widget child;
  final String title;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(
          title,
        ),
      ),
      body: child,
    );
  }
}
16
likes
0
pub points
59%
popularity

Publisher

verified publisherfluttercandies.com

Provide a route generator to create route map quickly by annotations.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

analyzer, args, dart_style, ff_annotation_route_core, io, meta, path, yaml

More

Packages that depend on ff_annotation_route