part of web;

class ReadInputDiscuss extends StatefulWidget {
  final ReadController controller;
  const ReadInputDiscuss({
    Key? key,
    required this.controller,
  }) : super(key: key);

  @override
  State<ReadInputDiscuss> createState() => _ReadInputDiscussState();
}

class _ReadInputDiscussState extends State<ReadInputDiscuss> {
  @override
  Widget build(BuildContext context) {
    return Container(
        margin: EdgeInsets.symmetric(horizontal: 15.w),
        child: Column(
          children: [
            Container(
              margin: EdgeInsets.symmetric(vertical: 10.w),
              child: Row(
                children: [
                  Text('话题',style: TextStyle(fontSize: 14.w,color: Colours.c3,height: 1.5,fontWeight: Fonts.medium),),
                  Gaps.hGaps5,
                  Expanded(
                    child: ClipRRect(
                      borderRadius: BorderRadius.circular(4),
                      child: TextField(
                        focusNode: widget.controller.discussTitleFocusNode,
                        autofocus: true,
                        decoration: InputDecoration(
                          border: InputBorder.none,
                          enabledBorder: InputBorder.none,
                          focusedBorder: InputBorder.none,
                          hintText: '请输入话题名称',
                          hintStyle:TextStyle(fontSize: 12.w,height: 1.5,color: Colours.c9,),
                          filled: true,
                          fillColor: Colours.cF8,
                        ),
                      ),
                    ),
                  ),
                ],
              ),
            ),
            ClipRRect(
              borderRadius: BorderRadius.circular(4.w),
              child: Container(
                color: Colours.cF8,
                constraints: BoxConstraints(
                    minHeight: 100.w
                ),
                child: Column(
                  children: [
                    TextField(
                      focusNode: widget.controller.discussContentFocusNode,
                      maxLines: null,
                      decoration: InputDecoration(
                        border: InputBorder.none,
                        enabledBorder: InputBorder.none,
                        focusedBorder: InputBorder.none,
                        hintText: '请输入内容',
                        hintStyle:TextStyle(fontSize: 12.w,height: 1.5,color: Colours.c9,),
                        filled: true,
                        fillColor: Colours.cF8,
                      ),
                    ),
                    Column(
                      children: [
                        MediaQuery.removePadding(
                          context: context,
                          removeTop: true,
                          child: GridView.builder(
                            // padding: const EdgeInsets.only(left: 13,top: 10),
                            physics: const NeverScrollableScrollPhysics(),
                            shrinkWrap: true,
                            gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                                crossAxisCount: 6,
                                crossAxisSpacing: 2.w,
                                mainAxisSpacing: 2.w,
                                childAspectRatio: 1
                            ),
                            itemBuilder: (BuildContext context, int index) {
                              return Container(
                                color: Colors.red,
                                child: Center(child: Text('图片')),
                              );
                            },
                            itemCount: 0,
                          ),
                        ),
                        Container(
                          color: Colors.red,
                          child: MediaQuery.removePadding(
                            context: context,
                            removeTop: true,
                            child: ListView.builder(
                              physics: const NeverScrollableScrollPhysics(),
                              shrinkWrap: true,
                              itemBuilder: (BuildContext context, int index){
                                return Container(
                                  height: 20.w,
                                  margin: EdgeInsets.only(right: 130.w),
                                  child: Container(
                                    margin: EdgeInsets.only(top: 5.w),
                                    padding: EdgeInsets.only(right:20.w,left: 10.w),
                                    decoration: BoxDecoration(
                                      borderRadius: BorderRadius.circular(10.w),
                                      color: Colours.cF9,
                                    ),
                                    child: Row(
                                      // mainAxisSize: MainAxisSize.min,
                                      mainAxisAlignment:MainAxisAlignment.spaceBetween,
                                      children: [
                                        Image.asset('assets/images/audio.png'),
                                        Text('0:00/1:52',style: TextStyle(fontSize: 10.w,height: 1.4,color: Colours.c9),)
                                      ],
                                    ),
                                  ),
                                );
                              },
                              itemCount: 0,
                            ),
                          ),
                        )
                      ],
                    )
                  ],
                ),
              ),
            ),
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                Row(
                  children: [
                    Image.asset('assets/images/read_add_img.png'),
                    Gaps.hGaps10,
                    Image.asset('assets/images/read_add_audio.png'),
                  ],
                ),
                GestureDetector(
                  onTap: (){},
                  child: Container(
                    decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(15.w),
                      color: AppTheme.primary,
                      gradient: LinearGradient(
                        colors: [const Color(0xFFD53676).withOpacity(0.9),AppTheme.primary] , // 不可点击时的颜色，透明度为0.7
                        begin: Alignment.topCenter,
                        end: Alignment.bottomCenter,
                      ),
                    ),
                    padding:  EdgeInsets.symmetric(horizontal:13.5.w,vertical: 4.w),
                    child:  Text('发表',style: TextStyle(fontSize: 14.w,fontWeight: Fonts.medium,color: Colors.white),),
                  ),
                )
              ],
            )
          ],
        )
    );
  }
}
