0

How can I make the responsive Content in Container, when I put anything in a container and the Height content is oversize what is the solution for this? I need to fix it when the user input too much information about the post and I warp it with less/more plugins and when the user uses it the screen is over pixel for sure

I use media query on the container that means I fix the size is okay so it's will happen if too much text

  Widget _postWidget() {
    return Container(
      height: MediaQuery.of(context).size.height * 0.40,
      width: MediaQuery.of(context).size.width * 1,
      child: Column(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Expanded(
            flex: 1,
            child: Container(
              padding: EdgeInsets.symmetric(horizontal: 20),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Expanded(
                    flex: 1,
                    child: Container(
                      height: 45, //height, //155,
                      width: 45, //width, //155,
                      decoration: BoxDecoration(
                        shape: BoxShape.circle,
                        color: const Color(0xff7c94b6),
                        image: DecorationImage(
                          image: NetworkImage(''),
                          fit: BoxFit.cover,
                        ),
                      ),
                    ),
                  ),
                  Expanded(
                    flex: 6,
                    child: Padding(
                      padding: EdgeInsets.symmetric(horizontal: 10),
                      child: Column(
                        mainAxisAlignment: MainAxisAlignment.center,
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          RichText(
                            text: TextSpan(
                              text: '[C]post.username  ',
                              style: TextStyle(
                                  color: Colors.black,
                                  fontFamily: 'SukhumvitSetBold',
                                  fontWeight: FontWeight.bold),
                              children: const <TextSpan>[
                                TextSpan(
                                    text: '3h',
                                    style: TextStyle(
                                        color: Colors.grey,
                                        fontFamily: 'SukhumvitSetBold',
                                        fontWeight: FontWeight.w400)),
                              ],
                            ),
                          ),
                          Text(
                            '[user]Desuka',
                            style: TextStyle(
                              color: Colors.grey[500],
                              fontFamily: 'SukhumvitSetMedium',
                            ),
                          )
                        ],
                      ),
                    ),
                  ),
                  Expanded(
                      flex: 2,
                      child: SizedBox(
                          width: 200.0,
                          height: 30.0,
                          child: OutlinedButton(
                            child: Text(
                              'Join+',
                              style: TextStyle(
                                color: HexColor("7225FF"),
                              ),
                            ),
                            onPressed: () => print("it's pressed"),
                            style: ElevatedButton.styleFrom(
                              side: BorderSide(
                                width: 1.5,
                                color: HexColor("7225FF"),
                              ),
                              shape: RoundedRectangleBorder(
                                borderRadius: BorderRadius.circular(32.0),
                              ),
                            ),
                          ))),
                ],
              ),
            ),
          ),
          InkWell(
            child: Container(
              margin: const EdgeInsets.only(
                top: 10,
                bottom: 10,
                right: 20,
                left: 20,
              ),
              width: double.infinity,
              height: 170.0,
              decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(16.0),
                image: DecorationImage(
                  image: NetworkImage(
                      'https://gitlab.com/2Shours/alphapic/raw/master/22.jpeg'),
                  fit: BoxFit.cover,
                ),
              ),
            ),
          ),
          SizedBox(
            height: 5,
          ),
          Padding(
            padding: const EdgeInsets.symmetric(horizontal: 20.0),
            child: Column(
              children: [
                Text(
                  'Travis Scott x Nike Fregment',
                  style: TextStyle(
                      color: Colors.black,
                      fontFamily: 'SukhumvitSetBold',
                      fontSize: 16,
                      fontWeight: FontWeight.bold),
                ),
              ],
            ),
          ),
          Padding(
            padding: const EdgeInsets.symmetric(horizontal: 20.0),
            child: Column(
              children: [
                ReadMoreText(
                  'The Flutter framework builds its layout via the composition of widgets, everything that you construct programmatically is a widget and these are compiled together to create the user interface. ',
                  style: TextStyle(
                      color: Colors.black,
                      fontSize: 15,
                      fontFamily: 'SukumvitSetMedium'),
                  trimLines: 2,
                  colorClickableText: HexColor("7225FF"),
                  trimMode: TrimMode.Line,
                  trimCollapsedText: 'More',
                  trimExpandedText: ' Less',
                ),
              ],
            ),
          ),
          Padding(
            padding: EdgeInsets.symmetric(horizontal: 10.0),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: <Widget>[
                Row(
                  children: <Widget>[
                    Row(
                      children: <Widget>[
                        IconButton(
                          icon: Icon(
                            (IconData(
                              0xe902,
                              fontFamily: 'heartPost',
                            )),
                            color: Colors.purple,
                            size: 20,
                          ),
                          iconSize: 30.0,
                          onPressed: () => print('Like post'),
                        ),
                        Text(
                          '2222',
                          style: TextStyle(
                            fontSize: 14.0,
                            fontFamily: 'SukhumvitSetMedium',
                            fontWeight: FontWeight.w600,
                          ),
                        ),
                      ],
                    ),
                    SizedBox(width: 10.0),
                    Row(
                      children: <Widget>[
                        IconButton(
                            icon: Icon(
                                IconData(0xe901, fontFamily: 'commentPost')),
                            iconSize: 20.0,
                            onPressed: () {}),
                        Text(
                          '2222',
                          style: TextStyle(
                            fontSize: 14.0,
                            fontFamily: 'SukhumvitSetMedium',
                            fontWeight: FontWeight.w600,
                          ),
                        ),
                      ],
                    ),
                    SizedBox(width: 20.0),
                    Row(
                      children: <Widget>[
                        IconButton(
                          icon: Icon(IconData(0xe906, fontFamily: 'offerPost')),
                          iconSize: 20.0,
                          onPressed: () {},
                        ),
                        Text(
                          'Offer',
                          style: TextStyle(
                            fontSize: 14.0,
                            fontFamily: 'SukhumvitSetMedium',
                            fontWeight: FontWeight.w600,
                          ),
                        ),
                      ],
                    ),
                  ],
                ),
                IconButton(
                  icon: Icon(
                    (IconData(
                      0xe908,
                      fontFamily: 'wishlistPost',
                    )),
                    color: Colors.purple,
                    size: 20,
                  ),
                  iconSize: 30.0,
                  onPressed: () => print('Save post'),
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }

enter image description here

enter image description here

Crown716
  • 115
  • 10
imdsk
  • 75
  • 2
  • 10

0 Answers0