| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- import 'package:flutter/material.dart';
- import 'package:jmrh/constant/styles.dart';
- import 'package:jmrh/widget/item_post.dart';
- import 'package:jmrh/widget/item_qa.dart';
- class Qa extends StatefulWidget {
- Qa({Key key}) : super(key: key);
- @override
- _QaState createState() => _QaState();
- }
- class _QaState extends State<Qa> {
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- body: CustomScrollView(
- slivers: [
- SliverAppBar(
- pinned: true,
- floating: true,
- title: appbarTitle('学习交流', color: Colors.white),
- centerTitle: true,
- elevation: 0,
- bottom: PreferredSize(
- child: Container(
- decoration: BoxDecoration(color: COLOR_PRIMARY),
- child: Container(
- height: 32,
- margin: EdgeInsets.fromLTRB(16, 9, 16, 9),
- padding: EdgeInsets.only(left: 10),
- decoration: BoxDecoration(color: Colors.white.withAlpha((255 * 0.2).toInt())),
- child: InkWell(
- child: Row(
- children: <Widget>[
- Image.asset('img/icon_search_white.png'),
- Container(
- child: Text(
- '搜索...',
- style: TextStyle(fontSize: 12, color: Colors.white),
- ),
- margin: EdgeInsets.only(left: 6),
- ),
- ],
- ),
- onTap: () {
- Navigator.pushNamed(context, '/search');
- },
- ),
- ),
- ),
- preferredSize: Size.fromHeight(50)),
- ),
- SliverPadding(
- padding: EdgeInsets.only(left: 16, right: 16, top: 20),
- sliver: SliverGrid.count(
- crossAxisCount: 2,
- childAspectRatio: 2,
- crossAxisSpacing: 15,
- children: [
- InkWell(
- child: Container(
- decoration: BoxDecoration(color: Color(0xFFF2F7FF)),
- padding: EdgeInsets.fromLTRB(14, 18, 14, 18),
- height: 80,
- child: Row(
- children: [
- Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Text(
- '政民互动',
- style: TextStyle(color: Color(0xFF4074DB), fontWeight: FontWeight.bold),
- ),
- Container(
- margin: EdgeInsets.only(top: 3),
- child: Text(
- '有问题及时沟通',
- style: TextStyle(color: Color(0x804175DB), fontSize: 10),
- ),
- )
- ],
- ),
- ),
- Image.asset('img/hudong_icon_01.png')
- ],
- ),
- ),
- onTap: () {
- Navigator.of(context).pushNamed('/qaList');
- },
- ),
- InkWell(
- child: Container(
- decoration: BoxDecoration(color: Color(0xFFFEF2EC)),
- padding: EdgeInsets.fromLTRB(14, 18, 14, 18),
- height: 80,
- child: Row(
- children: [
- Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Text(
- '知识文库',
- style: TextStyle(color: Color(0xFFF47C4E), fontWeight: FontWeight.bold),
- ),
- Container(
- margin: EdgeInsets.only(top: 3),
- child: Text(
- '学习必备常识',
- style: TextStyle(color: Color(0xB3F47C4E), fontSize: 10),
- ),
- )
- ],
- ),
- ),
- Image.asset('img/hudong_icon_02.png')
- ],
- ),
- ),
- onTap: () {
- Navigator.of(context).pushNamed('/itemList');
- },
- )
- ],
- ),
- ),
- SliverPadding(
- padding: EdgeInsets.fromLTRB(16, 20, 16, 10),
- sliver: SliverToBoxAdapter(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- '官方问答',
- style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
- ),
- ClipRRect(
- borderRadius: BorderRadius.all(Radius.circular(4)),
- child: Container(
- child: Image.asset('img/img_02.png'),
- margin: EdgeInsets.only(top: 10),
- ),
- )
- ],
- ),
- ),
- ),
- SliverList(
- delegate: SliverChildBuilderDelegate(
- (BuildContext context, int index) {
- if (index.isOdd) {
- return Divider(indent: 16, endIndent: 16, height: 1);
- }
- return ItemQa();
- },
- childCount: 5,
- ),
- ),
- SliverToBoxAdapter(
- child: Container(
- alignment: Alignment.center,
- margin: EdgeInsets.only(top: 10),
- child: Container(
- padding: EdgeInsets.only(left: 6),
- width: 110,
- height: 30,
- decoration: BoxDecoration(
- color: COLOR_BORDER,
- borderRadius: BorderRadius.all(
- Radius.circular(15),
- ),
- ),
- child: InkWell(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Text(
- '查看更多',
- style: TextStyle(color: COLOR_TEXT_HINT, fontSize: 13),
- ),
- Image.asset('img/icon_inter.png')
- ],
- ),
- onTap: () {
- Navigator.of(context).pushNamed('/qaList');
- },
- ),
- ),
- ),
- ),
- SliverToBoxAdapter(
- child: Container(
- child: Text(
- '热议话题',
- style: TextStyle(color: COLOR_TEXT_1, fontSize: 18, fontWeight: FontWeight.bold),
- ),
- padding: EdgeInsets.fromLTRB(16, 24, 0, 8),
- ),
- ),
- SliverList(
- delegate: SliverChildBuilderDelegate((context, index) {
- if (index.isOdd) {
- return Divider(color: COLOR_BORDER, indent: 16, endIndent: 16, height: 1);
- }
- return ItemPost();
- }, childCount: 5),
- )
- ],
- ),
- );
- }
- }
|