import 'package:flutter/material.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/view_widget/my_tab.dart'; class IntegralDetailedPage extends StatefulWidget { @override State createState() { return _IntegralDetailedPage(); } } class _IntegralDetailedPage extends State with SingleTickerProviderStateMixin { List _tabs; TabController tabController; @override void initState() { super.initState(); } @override void didChangeDependencies() { super.didChangeDependencies(); _tabs = [ MyTab( text: S.of(context).huode, ), MyTab( text: S.of(context).xiaofei, ), ]; tabController = TabController(length: 2, vsync: this) ..addListener(() { // tabController.index }); } @override Widget build(BuildContext context) { return Scaffold( body: NestedScrollView( headerSliverBuilder: (context, inner) { return [ SliverAppBar( pinned: true, backgroundColor: Color(0xFF32A060), elevation: 0, title: Text( S.of(context).mingxi, style: TextStyle(color: Colors.white), ), centerTitle: false, leading: GestureDetector( onTap: () { Navigator.of(context).pop(); }, child: Container( alignment: Alignment.centerRight, margin: EdgeInsets.only(left: 10), padding: EdgeInsets.all(6), child: Icon( Icons.arrow_back_ios, color: Colors.white, size: 24, ), ), ), titleSpacing: 2, leadingWidth: 56, flexibleSpace: FlexibleSpaceBar( background: Container( alignment: Alignment.center, margin: EdgeInsets.only(top: 56), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( "90", style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontSize: 48), ), Text( S.of(context).wodejifenzhi, style: TextStyle(color: Color(0xFFF2F2F2), fontSize: 12), ), ], ), ), ), expandedHeight: 228, bottom: PreferredSize( preferredSize: Size(double.infinity, 38), child: TabBar( tabs: _tabs, controller: tabController, isScrollable: false, indicatorSize: TabBarIndicatorSize.label, labelColor: Colors.white, labelStyle: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), unselectedLabelStyle: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), indicatorColor: Colors.white, unselectedLabelColor: Color(0xFFE6E6E6), ), ), ), ]; }, body: Container( child: ListView.builder( itemCount: 10, padding: EdgeInsets.only(top: 8, bottom: 8), itemBuilder: (context, position) { return Container( margin: EdgeInsets.fromLTRB(16, 8, 16, 8), padding: EdgeInsets.fromLTRB(14, 7, 16, 7), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(2)), boxShadow: [ BoxShadow( color: Colors.black.withAlpha(25), offset: Offset(0, 1), blurRadius: 12, spreadRadius: 0) ]), child: Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Image.asset( "assets/image/icon_intergral_sign.png", width: 36, height: 34, ), SizedBox( width: 15, ), Expanded( child: Container( height: 34, alignment: Alignment.centerLeft, child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( S.of(context).qiandao, style: TextStyle(color: Colors.black, fontSize: 12), ), Text( "2020.01.03 13:03", style: TextStyle( color: Color(0xFF727272), fontSize: 10), ) ], ), )), Container( margin: EdgeInsets.only(top: 2), child: Text( "+10", style: TextStyle(color: Color(0xFF727272), fontSize: 12), ), ) ], ), ); }), ), ), ); } }