12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- import 'package:flutter/material.dart';
- import 'package:flutter/cupertino.dart';
- import 'package:ysairplane/base/YSBase.dart';
- import 'package:ysairplane/tools/YSNetWorking.dart';
- import 'package:ysairplane/tools/YSTools.dart';
- class YSNewDetail extends StatefulWidget {
- final String newId;
- const YSNewDetail({Key key, this.newId}) : super(key: key);
- @override
- _YSNewDetailState createState() => _YSNewDetailState();
- }
- class _YSNewDetailState extends State<YSNewDetail> {
- Map _dict;
- @override
- void initState() {
- Future.delayed(Duration(seconds: 0)).then((value){
- _getNewsDetailData();
- });
- super.initState();
- }
- @override
- Widget build(BuildContext context) {
- return YSBase(
- ystitle: '详情',
- yschild: _dict==null?Container():Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-44-hsp(160),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- padding: EdgeInsets.all(hsp(40)),
- child: Text('${_dict['title']}',style: TextStyle(color: Color(0xFF333333),fontSize: zsp(36),fontWeight: FontWeight.bold),),
- ),
- Container(
- padding: EdgeInsets.only(top: hsp(10),left: hsp(40),right: hsp(40),bottom: hsp(60)),
- child: Text('${_dict['createtime']} ${_dict['author']}',style: TextStyle(color: Color(0xFF999999),fontSize: zsp(24)),),
- ),
- ],
- ),
- ),
- Container(
- height: hsp(160),
- padding: EdgeInsets.all(hsp(30)),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Container(
- width: (MediaQuery.of(context).size.width-wsp(100))/2,
- height: hsp(83),
- color: Color(0xFFF8F8F8),
- alignment: Alignment.center,
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Image(image: AssetImage('lib/images/agree.png'),height: hsp(50),width: hsp(50),),
- Text(' ${_dict['likeCount']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF636363)),)
- ],
- ),
- ),
- Container(
- width: (MediaQuery.of(context).size.width-wsp(100))/2,
- height: hsp(83),
- color: Color(0xFFF8F8F8),
- alignment: Alignment.center,
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Image(image: AssetImage('lib/images/wechat.png'),height: hsp(50),width: hsp(50),),
- Text(' 微信好友',style: TextStyle(fontSize: zsp(28),color: Color(0xFF636363)),)
- ],
- ),
- )
- ],
- ),
- )
- ],
- ),
- );
- }
- _getNewsDetailData() async{
- Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/headline/details',parameter: {'id':widget.newId},isLoading: true);
- if(dict!=null){
- setState(() {
- _dict = dict['data'];
- });
- }
- }
- }
|