Skip to content

huaqingyi/fpyi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fpyi

A new flutter plugin project.

Getting Started

This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

flutter install

  • pubspec.yaml
dev_dependencies:
  flutter_test:
    sdk: flutter

  fpyi: ^0.0.2

Quick Start

  • main.dart
import 'package:flutter/material.dart';
import 'package:fpyi/fpyi.dart';
import 'router.dart';

class App extends PYIComponent {
  final Fpyi fpyi;
  App({this.fpyi});

  @override
  Widget render(BuildContext context) {
    return MaterialApp(
      title: 'PYI Async Package',
      initialRoute: '/',
      onGenerateRoute: fpyi.getRoutes,
    );
  }
}

void main() {
  final fpyi = Fpyi(
    router: root,
  );
  fpyi.bootstrap(
    App(
      fpyi: fpyi,
    ),
  );
  // runApp(App());
}
  • router.dart
import 'package:fpyi/fpyi.dart';
import 'package:fpyi_example/layout/layout.dart';
import 'package:fpyi_example/layout/router.dart';
import 'package:fpyi_example/login/login.dart';

List<PYIRoute> root = [
  PYIRoute(
    path: '/',
    component: Layout(),
    children: layout
  ),
  PYIRoute(
    path: '/login',
    component: Login(),
  )
];
  • layout/layout.dart
import 'package:flutter/material.dart';
import 'package:fpyi/fpyi.dart';

class Layout extends PYIComponent {
  @override
  Widget render(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Layout ...'),
      ),
      body: Center(
        child: Column(
          children: <Widget>[
            Text('Layout Header ...'),
            Expanded(
              child: RouteView().display,
            ),
            Text('Layout Footer ...'),
          ],
        ),
      ),
    );
  }
}

Thinks ...

About

flutter pyi router plugins

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published