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

discontinued
outdated

Navigation and UI elements which fits with Osam library

example/lib/main.dart

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:osam_flutter/osam_flutter.dart';

void main() async {
  runApp(UseCaseProvider(
    null,
    null,
    null,
    child: PresenterProvider(
      presenter: NavPresenter(),
      child: MaterialApp(
        home: const App(),
      ),
    ),
  ));
}

class App extends StatelessWidget {
  const App();
  @override
  Widget build(BuildContext context) {
    return OsamNavigator<NavPresenter>(
      {
        '1': (ctx) => Page1(key: ValueKey('1'), color: Colors.red),
        '2': (ctx) => Page1(key: ValueKey('2'), color: Colors.green),
        '3': (ctx) => Page1(key: ValueKey('3'), color: Colors.yellow),
      },
      log: true,
    );
  }
}

//child: WillPopScope(
//child: ,
//onWillPop: () async {
//context.presenter<NavPresenter>().pop();
//return true;
//},
//)

class Page1 extends StatelessWidget {
  final Color color;

  const Page1({Key key, this.color}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      body: Container(
        color: color,
        child: Center(
          child: Column(
            children: <Widget>[
              RaisedButton(
                onPressed: () async {
                  if (color == Colors.red) {
                    nav.push('2');
                  } else if (color == Colors.green) {
                    nav.push('3');
                  } else {
                    nav.push('4');
                  }
                },
              ),
            ],
          ),
        ),
      ),
    );
  }
}

class NavPresenter extends Presenter with NavigationPresenter {
  @override
  NavigationState get navigationState => nav;
}

final nav = NavigationState(['1']);
2
likes
0
pub points
0%
popularity

Publisher

verified publisherrenesanse.net

Navigation and UI elements which fits with Osam library

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

after_layout, flutter, osam, provider

More

Packages that depend on osam_flutter