responsive_property 0.0.7 copy "responsive_property: ^0.0.7" to clipboard
responsive_property: ^0.0.7 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:example/responsive_builder.dart';
import 'package:example/responsive_flex.dart';
import 'package:example/responsive_int.dart';
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Responsive Styled Widget"),
      ),
      body: Center(
          child: Container(
              width: 300,
              child: ListView(
                children: [
                  Center(
                    child: Padding(
                      padding: const EdgeInsets.all(8.0),
                      child: Text(
                        "Responsive Examples",
                        style: TextStyle(
                            fontSize: 20, fontWeight: FontWeight.bold),
                      ),
                    ),
                  ),
                  ElevatedButton(
                      onPressed: () {
                        Navigator.push(
                            context,
                            MaterialPageRoute(
                                builder: (context) => ResponsiveIntPage()));
                      },
                      child: Text("Responsive Int")),
                  ElevatedButton(
                      onPressed: () {
                        Navigator.push(
                            context,
                            MaterialPageRoute(
                                builder: (context) => ResponsiveFlexPage()));
                      },
                      child: Text("Responsive Flex")),
                  ElevatedButton(
                      onPressed: () {
                        Navigator.push(
                            context,
                            MaterialPageRoute(
                                builder: (context) => ResponsiveBuilderPage()));
                      },
                      child: Text("Responsive Builder")),
                ],
              ))),
    );
  }
}
10
likes
120
pub points
53%
popularity

Publisher

verified publisherwenkaifan.com

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, flutter_class_parser

More

Packages that depend on responsive_property