flutter_staggered_grid_view icon indicating copy to clipboard operation
flutter_staggered_grid_view copied to clipboard

What is the Tile widget in the example?

Open wyxcoder opened this issue 1 year ago • 1 comments

I cannot locate the widget Title?

wyxcoder avatar Aug 29 '23 03:08 wyxcoder

@wyxcoder

https://github.com/letsar/flutter_staggered_grid_view/blob/0bfd05f285a6ecf390a8927e6ad4e67f7a39979b/examples/lib/common.dart#L31C1-L75C2


class Tile extends StatelessWidget {
  const Tile({
    Key? key,
    required this.index,
    this.extent,
    this.backgroundColor,
    this.bottomSpace,
  }) : super(key: key);

  final int index;
  final double? extent;
  final double? bottomSpace;
  final Color? backgroundColor;

  @override
  Widget build(BuildContext context) {
    final child = Container(
      color: backgroundColor,
      height: extent,
      child: Center(
        child: CircleAvatar(
          minRadius: 20,
          maxRadius: 20,
          backgroundColor: Colors.white,
          foregroundColor: Colors.black,
          child: Text('$index', style: const TextStyle(fontSize: 20)),
        ),
      ),
    );

    if (bottomSpace == null) {
      return child;
    }

    return Column(
      children: [
        Expanded(child: child),
        Container(
          height: bottomSpace,
          color: Colors.green,
        )
      ],
    );
  }
}

alexrabin avatar Oct 08 '23 18:10 alexrabin