flutterx_application 1.1.6 copy "flutterx_application: ^1.1.6" to clipboard
flutterx_application: ^1.1.6 copied to clipboard

outdated

Core functionalities of a flutter application including translations, lifecycle events, navigation, dialogs

example/lib/main.dart

import 'package:example/localization/labels.dart';
import 'package:example/ui/activity_data_delegate.dart';
import 'package:example/ui/activity_data_insert.dart';
import 'package:example/ui/activity_home.dart';
import 'package:example/ui/activity_login.dart';
import 'package:example/ui/activity_private.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutterx_application/flutterx_application.dart';

void main() => runApplication(
    name: 'Flutterx Application Demo',
    routes: {
      HomeActivity.route,
      DataDelegateActivity.route,
      DataInsertActivity.route,
      LoginActivity.route,
      PrivateActivity.route,
    },
    onUnknownRoute: (args) => _UnknownRouteActivity.route,
    labels: Labels.supportedLabels,
    onLabel: Labels.onLabel,
    appFactory: (key, routeInformationProvider, routeInformationParser, routerDelegate, onGenerateTitle, locale,
            localizationsDelegates, supportedLocales) =>
        MaterialApp.router(
            key: key,
            routeInformationProvider: routeInformationProvider,
            routeInformationParser: routeInformationParser,
            routerDelegate: routerDelegate,
            theme: _appTheme,
            onGenerateTitle: onGenerateTitle,
            locale: locale,
            localizationsDelegates: localizationsDelegates,
            supportedLocales: supportedLocales,
            debugShowCheckedModeBanner: false));

final _appTheme = ThemeData(
    primaryColor: Colors.blueGrey,
    colorScheme: ColorScheme.fromSwatch(
      primarySwatch: Colors.blueGrey,
    ),
    bottomSheetTheme: BottomSheetThemeData(
      backgroundColor: Colors.blueGrey[600],
    ));

class _UnknownRouteActivity extends StatelessWidget {
  static final ActivityRoute<String?> route =
      ActivityRoute(location: '/404', builder: (context, args) => _UnknownRouteActivity._(location: args['location']));

  final String location;

  const _UnknownRouteActivity._({Key? key, required this.location}) : super(key: key);

  @override
  Widget build(BuildContext context) => Scaffold(
        body: Center(
          child: Column(mainAxisSize: MainAxisSize.min, children: [
            const Text('404', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 32)),
            const SizedBox(height: 48),
            Text('Requested page not found: $location'),
            const SizedBox(height: 24),
            ElevatedButton(onPressed: () => Navigator.of(context).maybePop(), child: const Text('Back')),
          ]),
        ),
      );
}
4
likes
0
points
164
downloads

Publisher

unverified uploader

Weekly Downloads

Core functionalities of a flutter application including translations, lifecycle events, navigation, dialogs

Repository (GitLab)
View/report issues

License

unknown (license)

Dependencies

collection, flutter, flutter_localizations, flutterx_live_data, flutterx_utils

More

Packages that depend on flutterx_application