You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
93 lines
2.9 KiB
93 lines
2.9 KiB
4 years ago
|
import 'package:flutter/material.dart';
|
||
|
import 'package:huixiang/generated/l10n.dart';
|
||
|
import 'package:huixiang/home/activity_list_page.dart';
|
||
|
import 'package:huixiang/home/home_page.dart';
|
||
|
import 'package:huixiang/home/huixiang_brand_page.dart';
|
||
|
import 'package:huixiang/home/points_mall_page.dart';
|
||
|
import 'package:huixiang/view_widget/my_tab.dart';
|
||
|
|
||
|
class MainHomePage extends StatefulWidget {
|
||
|
@override
|
||
|
State<StatefulWidget> createState() {
|
||
|
return _MainHomePage();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
class _MainHomePage extends State<MainHomePage>
|
||
|
with SingleTickerProviderStateMixin {
|
||
|
var tabcontroller;
|
||
|
List<Widget> _widgetOptions;
|
||
|
|
||
|
@override
|
||
|
void initState() {
|
||
|
super.initState();
|
||
|
if (tabcontroller == null)
|
||
|
tabcontroller = TabController(length: 3, vsync: this);
|
||
|
tabcontroller.addListener(() => () {});
|
||
|
|
||
|
//NoDataView(),
|
||
|
_widgetOptions = <Widget>[HomePage(), ActivityListPage(), PointsMallPage()];
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return DefaultTabController(
|
||
|
length: 3,
|
||
|
child: Scaffold(
|
||
|
appBar: AppBar(
|
||
|
backgroundColor: Color(0xFFFAFAFA),
|
||
|
elevation: 0,
|
||
|
toolbarOpacity: 0,
|
||
|
toolbarHeight: 50,
|
||
|
automaticallyImplyLeading: false,
|
||
|
actions: [
|
||
|
Container(
|
||
|
margin: EdgeInsets.only(right: 17),
|
||
|
child: GestureDetector(
|
||
|
onTap: () {
|
||
|
Navigator.of(context).pushNamed("/router/msg_page");
|
||
|
},
|
||
|
child: Image.asset(
|
||
|
"assets/image/icon_notices.png",
|
||
|
width: 24,
|
||
|
height: 24,
|
||
|
),
|
||
|
),
|
||
|
)
|
||
|
],
|
||
|
title: TabBar(
|
||
|
controller: tabcontroller,
|
||
|
automaticIndicatorColorAdjustment: true,
|
||
|
isScrollable: true,
|
||
|
indicatorWeight: 2,
|
||
|
indicatorColor: Color(0xFF39B54A),
|
||
|
labelPadding: EdgeInsets.only(left: 8, right: 8),
|
||
|
indicatorSize: TabBarIndicatorSize.label,
|
||
|
unselectedLabelStyle: TextStyle(
|
||
|
fontSize: 16,
|
||
|
fontWeight: FontWeight.normal,
|
||
|
),
|
||
|
labelStyle: TextStyle(
|
||
|
color: Colors.black,
|
||
|
fontSize: 17,
|
||
|
fontWeight: FontWeight.bold,
|
||
|
),
|
||
|
labelColor: Colors.black,
|
||
|
tabs: [
|
||
|
MyTab(text: S.of(context).shouye),
|
||
|
MyTab(
|
||
|
text: S.of(context).huodongliebiao,
|
||
|
),
|
||
|
MyTab(
|
||
|
text: S.of(context).jifenshangcheng,
|
||
|
),
|
||
|
]),
|
||
|
),
|
||
|
body: TabBarView(
|
||
|
children: _widgetOptions,
|
||
|
controller: tabcontroller,
|
||
|
),
|
||
|
));
|
||
|
}
|
||
|
}
|