1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
| import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; import 'package:flutter_ducafecat_news/common/entitys/entitys.dart'; import 'package:flutter_ducafecat_news/common/utils/utils.dart'; import 'package:flutter_ducafecat_news/common/values/values.dart'; import 'package:flutter_ducafecat_news/common/widgets/widgets.dart'; import 'package:flutter_ducafecat_news/common/router/router.gr.dart';
Widget newsItem(GqlNewsResponseEntity item) { return Container( height: duSetHeight(161), padding: EdgeInsets.all(duSetWidth(20)), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ InkWell( onTap: () { ExtendedNavigator.rootNavigator.pushNamed( Routes.detailsPageRoute, arguments: DetailsPageArguments(item: item), ); }, child: imageCached( '$SERVER_STRAPI_GRAPHQL_URL${item.thumbnail.url}', width: duSetWidth(121), height: duSetWidth(121), ), ), SizedBox( width: duSetWidth(194), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Container( margin: EdgeInsets.all(0), child: Text( item.author, style: TextStyle( fontFamily: 'Avenir', fontWeight: FontWeight.normal, color: AppColors.thirdElementText, fontSize: duSetFontSize(14), height: 1, ), ), ), InkWell( onTap: () { ExtendedNavigator.rootNavigator.pushNamed( Routes.detailsPageRoute, arguments: DetailsPageArguments(item: item), ); }, child: Container( margin: EdgeInsets.only(top: duSetHeight(10)), child: Text( item.title, style: TextStyle( fontFamily: 'Montserrat', fontWeight: FontWeight.w500, color: AppColors.primaryText, fontSize: duSetFontSize(16), height: 1, ), overflow: TextOverflow.clip, maxLines: 3, ), ), ), Spacer(), Container( child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ ConstrainedBox( constraints: BoxConstraints( maxWidth: duSetWidth(60), ), child: Text( item.category, style: TextStyle( fontFamily: 'Avenir', fontWeight: FontWeight.normal, color: AppColors.secondaryElementText, fontSize: duSetFontSize(14), height: 1, ), overflow: TextOverflow.clip, maxLines: 1, ), ), Container( width: duSetWidth(15), ), ConstrainedBox( constraints: BoxConstraints( maxWidth: duSetWidth(100), ), child: Text( '• ${duTimeLineFormat(item.addtime)}', style: TextStyle( fontFamily: 'Avenir', fontWeight: FontWeight.normal, color: AppColors.thirdElementText, fontSize: duSetFontSize(14), height: 1, ), overflow: TextOverflow.clip, maxLines: 1, ), ), Spacer(), InkWell( child: Icon( Icons.more_horiz, color: AppColors.primaryText, size: 24, ), onTap: () {}, ), ], ), ), ], ), ), ], ), ); }
|