Skip to content

Commit

Permalink
Modfiy:
Browse files Browse the repository at this point in the history
首页 轮播图 不置顶
免责 样式
  • Loading branch information
ryan730 committed Jan 13, 2019
1 parent 5d88d0c commit b43cd20
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 23 deletions.
34 changes: 26 additions & 8 deletions lib/components/disclaimer_msg.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,33 @@ class DisclaimerMsgState extends State<DisclaimerMsg> {
barrierDismissible: false, // user must tap button!
builder: (BuildContext context) {
return AlertDialog(
title: Text('免责声明'),
content: SingleChildScrollView(
child: ListBody(
children: <Widget>[
Text(disclaimerText1),
Text(disclaimerText2),
],
//title: Text('免责声明'),
content:SingleChildScrollView(
child: ListBody(
children: <Widget>[
Container(
padding: EdgeInsets.fromLTRB(5.0, 5.0, 10.0, 10.0),
//width: 100,
height: 35,
child: Text('免责声明',style:TextStyle(fontSize: 18,fontWeight:FontWeight.w700 )),
decoration: BoxDecoration(
//color: Colors.blue,
image: DecorationImage(
fit: BoxFit.fitWidth,
image: AssetImage('assets/images/paimaiLogo.png')
),
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
//alignment: Alignment.bottomRight,
)
),
SizedBox(height:20),
Text(disclaimerText1),
Text(disclaimerText2),
],
),
),
),
shape:RoundedRectangleBorder(borderRadius: new BorderRadius.circular(20.0)), // 圆角
actions: <Widget>[
Container(
Expand Down
10 changes: 7 additions & 3 deletions lib/components/list_refresh.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import 'package:flutter/material.dart';
class ListRefresh extends StatefulWidget {
final renderItem;
final requestApi;
final headerView;

const ListRefresh([this.requestApi, this.renderItem]) : super();
const ListRefresh([this.requestApi, this.renderItem, this.headerView]) : super();

@override
State<StatefulWidget> createState() => _ListRefreshState();
Expand Down Expand Up @@ -167,7 +168,11 @@ class _ListRefreshState extends State<ListRefresh> {
itemCount: items.length + 1,
itemBuilder: (context, index) {
if (index == 0 && index != items.length) {
return Container(height: 0);
if(widget.headerView is Function){
return widget.headerView();
}else {
return Container(height: 0);
}
}
if (index == items.length) {
//return _buildLoadText();
Expand All @@ -178,7 +183,6 @@ class _ListRefreshState extends State<ListRefresh> {
if (widget.renderItem is Function) {
return widget.renderItem(index, items[index]);
}
//return makeCard(index,items[index]);
}
},
controller: _scrollController,
Expand Down
45 changes: 33 additions & 12 deletions lib/views/first_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,25 +98,46 @@ class FirstPageState extends State<FirstPage> with AutomaticKeepAliveClientMixin
return new ListViewItem(itemUrl:codeUrl,itemTitle: myTitle,data: myUsername,);
}

@override
Widget build(BuildContext context) {
super.build(context);
return new Column(
headerView(){
return
Column(
children: <Widget>[
Stack(
//alignment: const FractionalOffset(0.9, 0.1),//方法一
children: <Widget>[
new Stack(
//alignment: const FractionalOffset(0.9, 0.1),//方法一
children: <Widget>[
Pagination(),
Positioned(//方法二
top: 10.0,
left: 0.0,
child: DisclaimerMsg(key:key,pWidget:this)
top: 10.0,
left: 0.0,
child: DisclaimerMsg(key:key,pWidget:this)
),
]),
SizedBox(height: 2, child:Container(color: Theme.of(context).primaryColor)),
SizedBox(height: 1, child:Container(color: Theme.of(context).primaryColor)),
SizedBox(height: 10),
],
);

}

@override
Widget build(BuildContext context) {
super.build(context);
return new Column(
children: <Widget>[
// new Stack(
// //alignment: const FractionalOffset(0.9, 0.1),//方法一
// children: <Widget>[
// Pagination(),
// Positioned(//方法二
// top: 10.0,
// left: 0.0,
// child: DisclaimerMsg(key:key,pWidget:this)
// ),
// ]),
// SizedBox(height: 2, child:Container(color: Theme.of(context).primaryColor)),
new Expanded(
//child: new List(),
child: listComp.ListRefresh(getIndexListData,makeCard)
child: listComp.ListRefresh(getIndexListData,makeCard,headerView)
)
]

Expand Down

0 comments on commit b43cd20

Please sign in to comment.