You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
151 lines
4.6 KiB
151 lines
4.6 KiB
import 'package:flutter/material.dart'; |
|
import 'package:huixiang/view_widget/item_title.dart'; |
|
import 'package:huixiang/view_widget/round_button.dart'; |
|
|
|
class ActivityListPage extends StatefulWidget { |
|
@override |
|
State<StatefulWidget> createState() { |
|
return _ActivityListPage(); |
|
} |
|
} |
|
|
|
class _ActivityListPage extends State<ActivityListPage> { |
|
@override |
|
Widget build(BuildContext context) { |
|
return Container( |
|
child: AnimatedList( |
|
// key: _listKey, |
|
physics: BouncingScrollPhysics(), |
|
initialItemCount: size, |
|
itemBuilder: (context, position, animation) { |
|
return buildItem(position, animation); |
|
}, |
|
), |
|
); |
|
} |
|
|
|
// final GlobalKey<AnimatedListState> _listKey = GlobalKey<AnimatedListState>(); |
|
int size = 15; |
|
// |
|
// void _addItem() { |
|
// _listKey.currentState.insertItem(size); |
|
// size += 1; |
|
// } |
|
// |
|
// void _removeItem() { |
|
// final int _index = size - 1; |
|
// _listKey.currentState.removeItem( |
|
// _index, (context, animation) => buildItem(_index, animation)); |
|
// size -= 1; |
|
// } |
|
|
|
Widget buildItem(position, animation) { |
|
if (position % 3 == 0) { |
|
return SizeTransition( |
|
sizeFactor: animation/*.drive(CurveTween(curve: Curves.easeIn)).drive( |
|
Tween<Offset>(begin: Offset(1, 1), end: Offset(0, 1)), |
|
)*/, |
|
child: activityTitleItem(), |
|
); |
|
} else { |
|
return SizeTransition( |
|
sizeFactor: animation/*.drive( |
|
CurveTween(curve: Curves.easeIn),).drive( |
|
Tween<Offset>( |
|
begin: Offset(1, 1), |
|
end: Offset(0, 1), |
|
), |
|
)*/, |
|
child: activityItem()); |
|
} |
|
} |
|
|
|
Widget activityTitleItem() { |
|
return Container( |
|
child: Column( |
|
children: [ |
|
ItemTitle(text: "进行中活动", imgPath: "assets/image/icon_today_task.png"), |
|
activityItem() |
|
], |
|
), |
|
); |
|
} |
|
|
|
Widget activityItem() { |
|
return Container( |
|
margin: EdgeInsets.all(16), |
|
decoration: BoxDecoration( |
|
color: Colors.white, |
|
boxShadow: [ |
|
BoxShadow( |
|
color: Colors.black.withAlpha(12), |
|
offset: Offset(0, 3), |
|
blurRadius: 14, |
|
spreadRadius: 0) |
|
], |
|
borderRadius: BorderRadius.all(Radius.circular(8))), |
|
child: Column( |
|
children: [ |
|
ClipRRect( |
|
borderRadius: BorderRadius.only( |
|
topLeft: Radius.circular(8), topRight: Radius.circular(8)), |
|
child: Image.network( |
|
"https://t7.baidu.com/it/u=1297102096,3476971300&fm=193&f=GIF", |
|
fit: BoxFit.cover, |
|
), |
|
), |
|
Container( |
|
padding: EdgeInsets.only(left: 16, right: 16, top: 8, bottom: 12), |
|
child: Column( |
|
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
children: [ |
|
Text( |
|
"评选人们最喜欢的美食!", |
|
style: TextStyle( |
|
fontWeight: FontWeight.bold, |
|
fontSize: 14, |
|
color: Colors.black), |
|
), |
|
Text( |
|
"评选人们最喜欢的美食!", |
|
style: TextStyle(fontSize: 10, color: Color(0xFF727272)), |
|
), |
|
Row( |
|
crossAxisAlignment: CrossAxisAlignment.end, |
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
children: [ |
|
Text( |
|
"海峡姐妹", |
|
style: TextStyle(color: Color(0xFF060606), fontSize: 12), |
|
), |
|
Column( |
|
crossAxisAlignment: CrossAxisAlignment.end, |
|
mainAxisAlignment: MainAxisAlignment.center, |
|
children: [ |
|
Text( |
|
"13:11", |
|
style: TextStyle( |
|
color: Color(0xFF32A060), |
|
fontSize: 12, |
|
fontWeight: FontWeight.bold), |
|
), |
|
Text( |
|
"2020.01.08", |
|
style: TextStyle( |
|
color: Color(0xFF32A060), |
|
fontSize: 12, |
|
fontWeight: FontWeight.bold), |
|
), |
|
], |
|
) |
|
], |
|
) |
|
], |
|
), |
|
) |
|
], |
|
), |
|
); |
|
} |
|
}
|
|
|