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/components/pagination.dart b/lib/components/pagination.dart index 2793882d..67cde6f6 100644 --- a/lib/components/pagination.dart +++ b/lib/components/pagination.dart @@ -18,8 +18,6 @@ class Pagination extends StatelessWidget { const Icon(Icons.language, semanticLabel: 'Language'), ]; - final List bannerStories = []; - final List arr = [ {'image': 'https://img.alicdn.com/tfs/TB1W4hMAwHqK1RjSZJnXXbNLpXa-519-260.jpg', 'type': 0, 'id': 9695909, 'url': 'https://www.zhihu.com/question/294145797/answer/551162834', 'title': '为什么阿里巴巴、腾讯和 Google 之类的企业都在使用 Flutter 开发 App?'}, {'image': 'https://img.alicdn.com/tfs/TB1XmFIApzqK1RjSZSgXXcpAVXa-720-338.jpg', 'type': 0, 'id': 9695859, 'url': 'https://zhuanlan.zhihu.com/p/51696594', 'title': 'Flutter 1.0 正式发布: Google 的便携 UI 工具包'}, @@ -37,6 +35,7 @@ class Pagination extends StatelessWidget { List _pageSelector(BuildContext context) { List list = []; + List bannerStories = []; /// super.initState(); arr.forEach((item) { bannerStories.add(StoryModel.fromJson(item)); @@ -55,6 +54,7 @@ class Pagination extends StatelessWidget { Widget build(BuildContext context) { return Column( + key:Key('__header__'), //physics: AlwaysScrollableScrollPhysics(), //padding: EdgeInsets.only(), children: _pageSelector(context) diff --git a/lib/views/first_page.dart b/lib/views/first_page.dart index b88ceb8b..d364b3e3 100644 --- a/lib/views/first_page.dart +++ b/lib/views/first_page.dart @@ -100,25 +100,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) ) ]