token_core_plugin 0.0.4 copy "token_core_plugin: ^0.0.4" to clipboard
token_core_plugin: ^0.0.4 copied to clipboard

A flutter plugin project for token.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:token_core_plugin_example/demos/btc.dart';
import 'package:token_core_plugin_example/demos/eth.dart';
import 'package:token_core_plugin_example/demos/identity.dart';

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}



class _MyAppState extends State<MyApp> with SingleTickerProviderStateMixin {

  TabController mController;

  List<TabItem> tabs = [
    TabItem('Identity Test', IdentityDemo()),
    TabItem('BTC Test',BTCDemo()),
    TabItem('USDT Test',Container(color: Colors.yellow,)),
    TabItem('ETH Test',ETHDemo()),
  ];

  @override
  void initState() {
    super.initState();
    mController = TabController(
      length: tabs.length,
      vsync: this,
    );
  }

  @override
  void dispose() {
    super.dispose();
    mController.dispose();
  }


  @override
  Widget build(BuildContext context) {

    return MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(title: Text('TokenCore Plugin Test'),),
        body: Column(
          children: <Widget>[
            Container(
              color: new Color(0xfff4f5f6),
              height: 38.0,
              child: TabBar(
                isScrollable: true,
                //是否可以滚动
                controller: mController,
                labelColor: Colors.blue,
                unselectedLabelColor: Colors.grey,
                labelStyle: TextStyle(fontSize: 16.0),
                tabs: tabs.map((item) {
                  return Tab(
                    text: item.label,
                  );
                }).toList(),
              ),
            ),
            Expanded(
              child: TabBarView(
                controller: mController,
                children: tabs.map((item) {
                  return Stack(children: <Widget>[
                    Align(alignment:Alignment.topCenter,child: item.widget,),
                  ],);
                }).toList(),
              ),
            )
          ],
        ),
      ),
    );
  }
}


class TabItem {
  String label;

  Widget widget;

  TabItem(this.label, this.widget);

}
0
likes
20
pub points
0%
popularity

Publisher

unverified uploader

A flutter plugin project for token.

Homepage

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on token_core_plugin