优化样式

This commit is contained in:
jyuesong
2022-01-19 15:29:11 +08:00
parent 1981edfafe
commit 0bdf267b36

View File

@@ -71,68 +71,68 @@ class _DependcyPageState extends State<DependencyPage> with TickerProviderStateM
), ),
], ],
), ),
body: SizedBox( body: Column(
width: MediaQuery.of(context).size.width, crossAxisAlignment: CrossAxisAlignment.start,
child: Column( mainAxisSize: MainAxisSize.max,
mainAxisSize: MainAxisSize.max, children: [
children: [ TabBar(
TabBar( controller: _tabController,
controller: _tabController, tabs: types
tabs: types .map(
.map((e) => Tab( (e) => Tab(
text: e.name, text: e.name,
)) ),
.toList(), )
isScrollable: true, .toList(),
indicator: AbsUnderlineTabIndicator( isScrollable: true,
wantWidth: 20, indicator: AbsUnderlineTabIndicator(
borderSide: BorderSide( wantWidth: 20,
color: Theme.of(context).primaryColor, borderSide: BorderSide(
width: 2, color: Theme.of(context).primaryColor,
), width: 2,
), ),
), ),
Expanded( ),
child: BaseStateWidget<DependencyViewModel>( Expanded(
onReady: (model) { child: BaseStateWidget<DependencyViewModel>(
model.loadData(types[0].name.toLowerCase()); onReady: (model) {
model.loadData(types[1].name.toLowerCase()); model.loadData(types[0].name.toLowerCase());
model.loadData(types[2].name.toLowerCase()); model.loadData(types[1].name.toLowerCase());
}, model.loadData(types[2].name.toLowerCase());
model: dependencyProvider, },
builder: (context, model, child) { model: dependencyProvider,
return TabBarView( builder: (context, model, child) {
controller: _tabController, return TabBarView(
children: types.map( controller: _tabController,
(e) { children: types.map(
List<DependencyBean> list; (e) {
if (e.index == 0) { List<DependencyBean> list;
list = model.nodeJsList; if (e.index == 0) {
} else if (e.index == 1) { list = model.nodeJsList;
list = model.python3List; } else if (e.index == 1) {
} else { list = model.python3List;
list = model.linuxList; } else {
} list = model.linuxList;
}
return RefreshIndicator( return RefreshIndicator(
child: ListView.builder( child: ListView.builder(
itemBuilder: (context, index) { itemBuilder: (context, index) {
return DependencyCell(e, list[index]); return DependencyCell(e, list[index]);
},
itemCount: list.length,
),
onRefresh: () {
return model.loadData(types[_tabController!.index].name.toLowerCase(), false);
}, },
); itemCount: list.length,
}, ),
).toList(), onRefresh: () {
); return model.loadData(types[_tabController!.index].name.toLowerCase(), false);
}, },
), );
},
).toList(),
);
},
), ),
], ),
), ],
), ),
); );
} }