wmh_segement 0.0.6 wmh_segement: ^0.0.6 copied to clipboard
A new flutter plugin project.
import 'package:flutter/material.dart';
import 'package:wmh_segement/wmh_segement.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> with SingleTickerProviderStateMixin{
TabController tabController;
List<Map> _adPictures = [
{'text' : 'hahaha'},
{'text' : 'hehehe'},
{'text' : 'xixixi'},
{'text' : 'hohoho'},
{'text' : 'heiheihei'},
{'text' : 'biubiubiu'},
{'text' : 'lalala'},
];
@override
void initState() {
super.initState();
tabController = new TabController(length: _adPictures.length, vsync: this);
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: Container(
child: WMHSegement(
appbarColor: Colors.lightBlue,
leadingWidget: Container(),
paramPages: _adPictures,
itemColor: Colors.black,
itemBackgroundColor: Colors.white,
indicateColor: Colors.red,
itemTitleFont: 16.0,
selectedColor: Colors.lightBlue,
unSelectColor: Colors.black,
indicatorHeight: 3.0,
haveSeperateLine: true,
bottomViewArr: _getWidgetArrs(),
titleWidget: Container(
child: Text('Segement标签页', style: TextStyle(color: Colors.white)),
),
haveCommonVIew: true,
commonWidget: Container(
height: 50,
width: 100,
color: Colors.red,
child: Text('hakjshjsa'),
),
tabController: tabController,
haveUpview: true,
commonWidgetUp: Container(
height: 50,
width: 100,
color: Colors.red,
child: Text('hakjshjsa'),
),
upViewHeight: 60,
),
),
),
),
);
}
_getWidgetArrs() {
List<Map> _adPictures = [
{'text' : 'hahaha'},
{'text' : 'hehehe'},
{'text' : 'xixixi'},
{'text' : 'hohoho'},
{'text' : 'heiheihei'},
{'text' : 'biubiubiu'},
{'text' : 'lalala'},
];
List<Widget> subArr = [];
for (var i = 0; i < _adPictures.length; i++) {
subArr.add(Container(
child: Center(child: Text(_adPictures[i]['text'].toString())),
color: Color.fromRGBO(237, 232 - i * 10, 240 - i * 20, 1.0),
));
}
return subArr;
}
}