Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:alibaba/flutter-common-widgets-a…
Browse files Browse the repository at this point in the history
…pp into develop
  • Loading branch information
hanxu317317 committed Jan 14, 2019
2 parents c94fab6 + fa3bec4 commit 26b2d3a
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 25 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
4 changes: 2 additions & 2 deletions lib/components/pagination.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ class Pagination extends StatelessWidget {
const Icon(Icons.language, semanticLabel: 'Language'),
];

final List<StoryModel> bannerStories = [];

final List<dynamic> 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 工具包'},
Expand All @@ -37,6 +35,7 @@ class Pagination extends StatelessWidget {

List<Widget> _pageSelector(BuildContext context) {
List<Widget> list = [];
List<StoryModel> bannerStories = [];
/// super.initState();
arr.forEach((item) {
bannerStories.add(StoryModel.fromJson(item));
Expand All @@ -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)
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 @@ -100,25 +100,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 26b2d3a

Please sign in to comment.