Skip to main content

responsive_property 0.0.8 copy "responsive_property: ^0.0.8" to clipboard
responsive_property: ^0.0.8 copied to clipboard

Inspired by Flutter's MaterialStateProperty, gives you a responsive value based on the current screen dimension.

example/lib/main.dart

import 'package:flutter/material.dart';

import 'responsive_builder.dart';
import 'responsive_flex.dart';
import 'responsive_int.dart';

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

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Responsive Property Demo',
      theme: ThemeData(primarySwatch: Colors.blue),
      home: const MyHomePage(title: 'Responsive Property'),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text(title)),
      body: Center(
        child: SizedBox(
          width: 300,
          child: ListView(
            children: [
              const Center(
                child: Padding(
                  padding: EdgeInsets.all(8.0),
                  child: Text(
                    'Responsive Examples',
                    style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
                  ),
                ),
              ),
              ElevatedButton(
                onPressed: () {
                  Navigator.push(
                    context,
                    MaterialPageRoute(
                      builder: (context) => const ResponsiveIntPage(),
                    ),
                  );
                },
                child: const Text('Responsive Int'),
              ),
              ElevatedButton(
                onPressed: () {
                  Navigator.push(
                    context,
                    MaterialPageRoute(
                      builder: (context) => const ResponsiveFlexPage(),
                    ),
                  );
                },
                child: const Text('Responsive Flex'),
              ),
              ElevatedButton(
                onPressed: () {
                  Navigator.push(
                    context,
                    MaterialPageRoute(
                      builder: (context) => const ResponsiveBuilderPage(),
                    ),
                  );
                },
                child: const Text('Responsive Builder'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
10
likes
160
points
21
downloads

Documentation

API reference

Publisher

verified publisherwenkaifan.com

Weekly Downloads

Inspired by Flutter's MaterialStateProperty, gives you a responsive value based on the current screen dimension.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter, flutter_class_parser

More

Packages that depend on responsive_property