flutter_widget_wrapper 1.0.1 copy "flutter_widget_wrapper: ^1.0.1" to clipboard
flutter_widget_wrapper: ^1.0.1 copied to clipboard

This is a flutter widget measurement widget and notify current size

example/lib/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Widget Wrapper',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const WrapperExample(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.grey.shade300,
      body: SafeArea(
        child: Container(
          margin: const EdgeInsets.all(24),
          child: Column(
            children: [
              WidgetWrapper(
                wrap: (con, size) {
                  return Expanded(
                    child: Container(
                      decoration: BoxDecoration(
                        color: Colors.white,
                        borderRadius: BorderRadius.circular(
                          size.width * 0.1,
                        ),
                      ),
                      alignment: Alignment.center,
                      child: Text("$size"),
                    ),
                  );
                },
              ),
              const SizedBox(height: 24, width: 24),
              WidgetWrapper(
                wrap: (con, size) {
                  return Expanded(
                    flex: 2,
                    child: Container(
                      alignment: Alignment.center,
                      decoration: BoxDecoration(
                        color: Colors.white,
                        borderRadius: BorderRadius.circular(
                          size.width * 0.1,
                        ),
                      ),
                      child: Text("$size"),
                    ),
                  );
                },
              ),
              const SizedBox(height: 24, width: 24),
              WidgetWrapper(
                wrap: (con, size) {
                  return Expanded(
                    child: Container(
                      alignment: Alignment.center,
                      decoration: BoxDecoration(
                        color: Colors.white,
                        borderRadius: BorderRadius.circular(
                          size.width * 0.1,
                        ),
                      ),
                      child: Text("$size"),
                    ),
                  );
                },
              ),
            ],
          ),
        ),
      ),
    );
  }
}
3
likes
140
pub points
3%
popularity

Publisher

unverified uploader

This is a flutter widget measurement widget and notify current size

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_widget_wrapper