jesusrp98 / expand_widget

Ability to easily expand and retract a widget collection or text
https://pub.dev/packages/expand_widget
GNU General Public License v3.0
45 stars 22 forks source link

child widget is not repainted when expanding #40

Open thunderbug1 opened 7 months ago

thunderbug1 commented 7 months ago

when trying to use expanded_widget to shorten a long markdown text displayed with https://pub.dev/packages/flutter_markdown, then the child widget is not rendered completely if the widget is expanded:

Collapsed: image

Expanded: image

                      ExpandChild(
                      collapsedVisibilityFactor: 0.2,
                      child: Markdown(
                        data: '''# Gather Around for a Board Game Bonanza! 🎲🎴

## Introduction
Invite your **friends** or **family** for an unforgettable evening of laughter, strategy, and fun with a **board game night**! Board games are the perfect way to connect with others, challenge your mind, and ignite a spark of joy in the comfortable setting of your own home.

## Why Board Games?
- **Social Connection**: A fantastic way to strengthen bonds and make new friends.
- **Mental Challenge**: Stimulates your brain and helps improve strategic thinking and problem-solving skills.
- **Universal Fun**: With a wide variety of games available, there's something for every age and interest.

## Getting Started
1. **Choose Your Games**: Whether you're into classics like *Monopoly* and *Clue* or want to explore new hits like *Catan* or *Ticket to Ride*, pick a few options to keep the night exciting.
2. **Prepare the Space**: Make sure your playing area is comfortable and spacious enough to accommodate all players and game components.
3. **Snacks and Drinks**: Keep some light snacks and beverages on hand to keep everyone energized and hydrated.

## Game Night Tips
- **Explain the Rules**: Make sure everyone understands the game's rules before starting to ensure a fair and enjoyable experience.
- **Keep it Light**: Remember, the goal is to have fun! Don't take the competition too seriously.
- **Rotate Games**: If you have time, switch between different games to keep the night fresh and engaging.

## Conclusion
It's not just about winning; it's about creating memorable moments with your loved ones. So dust off your favorite board games, gather around the table, and let the good times roll. **Game on!**
''',
                        selectable: false,
                        shrinkWrap: true,
                      ),
                    )
JamesMcIntosh commented 3 months ago

Hi Alex, could you give a more elaborate example which reproduces the issue as I added your example to the following simple code and it worked correctly.

Do you have a constraint on a parent widget which limits the size of the Markdown widget?

Maybe the Markdown shrinkWrap option affects the redrawing for you.

import 'package:flutter/material.dart';
import 'package:expand_widget/expand_widget.dart';
import 'package:flutter_markdown/flutter_markdown.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Center(
          child: SingleChildScrollView(
            child: ExpandChild(
              collapsedVisibilityFactor: 0.2,
              child: Markdown(
                data: '''# Gather Around for a Board Game Bonanza! 🎲🎴

## Introduction
Invite your **friends** or **family** for an unforgettable evening of laughter, strategy, and fun with a **board game night**! Board games are the perfect way to connect with others, challenge your mind, and ignite a spark of joy in the comfortable setting of your own home.

## Why Board Games?
- **Social Connection**: A fantastic way to strengthen bonds and make new friends.
- **Mental Challenge**: Stimulates your brain and helps improve strategic thinking and problem-solving skills.
- **Universal Fun**: With a wide variety of games available, there's something for every age and interest.

## Getting Started
1. **Choose Your Games**: Whether you're into classics like *Monopoly* and *Clue* or want to explore new hits like *Catan* or *Ticket to Ride*, pick a few options to keep the night exciting.
2. **Prepare the Space**: Make sure your playing area is comfortable and spacious enough to accommodate all players and game components.
3. **Snacks and Drinks**: Keep some light snacks and beverages on hand to keep everyone energized and hydrated.

## Game Night Tips
- **Explain the Rules**: Make sure everyone understands the game's rules before starting to ensure a fair and enjoyable experience.
- **Keep it Light**: Remember, the goal is to have fun! Don't take the competition too seriously.
- **Rotate Games**: If you have time, switch between different games to keep the night fresh and engaging.

## Conclusion
It's not just about winning; it's about creating memorable moments with your loved ones. So dust off your favorite board games, gather around the table, and let the good times roll. **Game on!**
''',
                selectable: false,
                shrinkWrap: true,
              ),
            ),
          ),
        ),
      ),
    );
  }
}