osam_flutter 1.0.8 copy "osam_flutter: ^1.0.8" to clipboard
osam_flutter: ^1.0.8 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(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return UseCaseProvider(
      null,
      null,
      null,
      child: PresenterProvider(
        presenter: NavPresenter(),
        child: MaterialApp(
          home: 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('2'), color: Colors.yellow),
            },
            log: 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.popUntil('1');
                  }
                },
              ),
              RaisedButton(
                onPressed: () {
                  nav.pushReplacement('2');
                },
              ),
            ],
          ),
        ),
      ),
    );
  }
}

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