/// 获取今日 模块的数据
static Future<TodayResult> requestToday() async {
final response = await http.get(todayURL);
final map = jsonDecode(response.body);
final code = map["code"];
final _data = map["data"];
final stateCode = _data["stateCode"];
final message = _data["message"];
final result = TodayResult(
code: code,
stateCode: stateCode,
message: message,
dayDataList: List<TodayModel>()
);
final _returnData = _data["returnData"];
final _dayDataList = _returnData["dayDataList"];
if (_dayDataList.length == 0) {
return result;
}
for (int i = 0; i < _dayDataList.length; i++) {
final _dayItemDataList = _dayDataList[i]["dayItemDataList"];
final publish = TodayPublishDate.fromJSON(_dayDataList[i]);
result.dayDataList.add(publish);
for (int j = 0; j < _dayItemDataList.length; j++) {
final _dayItemData = _dayItemDataList[j];
if (j != _dayItemDataList.length-1) {
final dayItemData = DayItemData.fromJSON(_dayItemData);
result.dayDataList.add(dayItemData);
} else {
final dayItemData2 = DayItemData2.fromJSON(_dayItemData);
result.dayDataList.add(dayItemData2);
}
}
}
return result;
Banner滚动:
class BannerWidget extends StatefulWidget {
final List<String> images;
BannerWidget(this.images, {Key key}): super(key: key);
_BannerWidgetState createState() => _BannerWidgetState();
}
class _BannerWidgetState extends State<BannerWidget> {
final pageController = PageController(initialPage: 0);
Timer timer;
void resetTimer() {
clearTimer();
timer = Timer.periodic(Duration(seconds: 3), (timer) {
if (pageController.positions.isNotEmpty) {
var i = pageController.page.toInt() + 1;
pageController.animateToPage(
i,
duration: Duration(milliseconds: 100),
curve: Curves.linear
);
if (i == widget.images.length-1) {
pageController.jumpToPage(0);
i = 0;
}
}
});
}
void clearTimer() {
if (timer != null) {
timer.cancel();
timer = null;
}
}
@override
void initState() {
// TODO: implement initState
super.initState();
resetTimer();
}
@override
Widget build(BuildContext context){
if (widget.images.length == 0) {
return null;
}
return SizedBox(
height: 231.0,
width: MediaQuery.of(context).size.width,
child: PageView.builder(
controller: pageController,
physics: PageScrollPhysics(parent: ClampingScrollPhysics()),
itemCount: widget.images.length,
itemBuilder: (context, index){
final url = widget.images[index];
return Image(
image: CachedNetworkImageProvider(url),
fit: BoxFit.cover,
);
},
)
);
}
@override
void dispose() {
// TODO: implement dispose
clearTimer();
super.dispose();
}
}
生成一个卡片的Widget:
Widget _generatorCardWidget(BuildContext context, List<ComicItemModel> list) {
return Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: list.map<Widget>((comic){
return Container(
width: (MediaQuery.of(context).size.width-20.0) / 3,
child: Card(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Image(
image: CachedNetworkImageProvider(comic.cover),
fit: BoxFit.cover,
),
Container(
padding: EdgeInsets.all(5.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(comic.name, style: TextStyle(fontSize: 15.0)),
Text(comic.shortDescription, style: TextStyle(fontSize: 12.0, color: Colors.grey))
],
),
),
],
),
),
);
}).toList(),
),
);
}
文末
当你打算跳槽的时候,应该把“跳槽成功后,我能学到什么东西?对我的未来发展有什么好处”放在第一位。这些东西才是真正引导你的关键。在跳槽之前尽量“物尽其用”,把手头上的工作做好,最好是完成了某个项目或是得到提升之后再走。跳槽不是目的,而是为了达到最终职业目标的手段
最后祝大家工作升职加薪,面试拿到心仪Offer.
CodeChina开源项目地址:https://codechina.csdn.net/m0_60958482/android_p7
m0_60958482/android_p7](https://codechina.csdn.net/m0_60958482/android_p7)**
[外链图片转存中…(img-234nRcbF-1630664712363)]
[外链图片转存中…(img-XWJnyTio-1630664712365)]