From b43cd20deb78447ddb2e7134f9f21e11b24fb4be Mon Sep 17 00:00:00 2001 From: ryan730 Date: Sun, 13 Jan 2019 23:54:16 +0800 Subject: [PATCH] =?UTF-8?q?Modfiy:=20=E9=A6=96=E9=A1=B5=20=E8=BD=AE?= =?UTF-8?q?=E6=92=AD=E5=9B=BE=20=E4=B8=8D=E7=BD=AE=E9=A1=B6=20=E5=85=8D?= =?UTF-8?q?=E8=B4=A3=20=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/components/disclaimer_msg.dart | 34 ++++++++++++++++------ lib/components/list_refresh.dart | 10 +++++-- lib/views/first_page.dart | 45 ++++++++++++++++++++++-------- 3 files changed, 66 insertions(+), 23 deletions(-) diff --git a/lib/components/disclaimer_msg.dart b/lib/components/disclaimer_msg.dart index 2862e3e4..999056f1 100644 --- a/lib/components/disclaimer_msg.dart +++ b/lib/components/disclaimer_msg.dart @@ -69,15 +69,33 @@ class DisclaimerMsgState extends State { barrierDismissible: false, // user must tap button! builder: (BuildContext context) { return AlertDialog( - title: Text('免责声明'), - content: SingleChildScrollView( - child: ListBody( - children: [ - Text(disclaimerText1), - Text(disclaimerText2), - ], + //title: Text('免责声明'), + content:SingleChildScrollView( + child: ListBody( + children: [ + 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: [ Container( diff --git a/lib/components/list_refresh.dart b/lib/components/list_refresh.dart index 32c11d71..6a8cd00a 100644 --- a/lib/components/list_refresh.dart +++ b/lib/components/list_refresh.dart @@ -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 createState() => _ListRefreshState(); @@ -167,7 +168,11 @@ class _ListRefreshState extends State { 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(); @@ -178,7 +183,6 @@ class _ListRefreshState extends State { if (widget.renderItem is Function) { return widget.renderItem(index, items[index]); } - //return makeCard(index,items[index]); } }, controller: _scrollController, diff --git a/lib/views/first_page.dart b/lib/views/first_page.dart index c31df0a2..59ffe0db 100644 --- a/lib/views/first_page.dart +++ b/lib/views/first_page.dart @@ -98,25 +98,46 @@ class FirstPageState extends State 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: [ + Stack( + //alignment: const FractionalOffset(0.9, 0.1),//方法一 children: [ - new Stack( - //alignment: const FractionalOffset(0.9, 0.1),//方法一 - children: [ 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: [ +// new Stack( +// //alignment: const FractionalOffset(0.9, 0.1),//方法一 +// children: [ +// 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) ) ]