atreeon_get_child_size 0.1.0 copy "atreeon_get_child_size: ^0.1.0" to clipboard
atreeon_get_child_size: ^0.1.0 copied to clipboard

A widget that returns the size of the child object. The [onChange] callback will run everytime the widget's size has changed.

example/lib/main.dart

// ignore_for_file: library_private_types_in_public_api

import 'package:atreeon_get_child_size/atreeon_get_child_size.dart';
import 'package:flutter/material.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: GetChildSize_Demo(),
    );
  }
}

class GetChildSize_Demo extends StatefulWidget {
  const GetChildSize_Demo({super.key});

  @override
  _GetChildSize_DemoState createState() => _GetChildSize_DemoState();
}

class _GetChildSize_DemoState extends State<GetChildSize_Demo> {
  var size = const Size(10, 10);

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Text("outside of widget:$size"),
        Expanded(
          child: GetChildSize(
            child: Text("inside widget:$size"),
            onChange: (x) => //
                setState(() => size = x),
          ),
        )
      ],
    );
  }
}
2
likes
0
pub points
57%
popularity

Publisher

verified publisheratreeon.com

A widget that returns the size of the child object. The [onChange] callback will run everytime the widget's size has changed.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

cupertino_icons, flutter

More

Packages that depend on atreeon_get_child_size