responsive_value 0.0.2 copy "responsive_value: ^0.0.2" to clipboard
responsive_value: ^0.0.2 copied to clipboard

Flutter plugin to help building responsive UI's easy.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:responsive_value/responsive_value.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: 'Responsive Value',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    var textSize = Responsive<double>(18, lg: 24).getValue(context);
    var width = Responsive<double>(100, md: 140, lg: 200).getValue(context);
    var boxColor = Responsive<Color>(Colors.red, lg: Colors.blue).getValue(context);
    var borderRadius = Responsive<double>(0, lg: 10).getValue(context);

    return Scaffold(
      appBar: AppBar(
        title: Text('Responsive Value'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'Responsive Text Size ($textSize px)',
              style: TextStyle(fontSize: textSize),
            ),
            SizedBox(height: 20),
            Container(
              width: width,
              height: 80,
              decoration: BoxDecoration(
                color: boxColor,
                borderRadius: BorderRadius.circular(borderRadius),
              ),
              child: Center(
                child: Text(
                  'Responsive Color',
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
2
likes
30
pub points
30%
popularity

Publisher

unverified uploader

Flutter plugin to help building responsive UI's easy.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on responsive_value