responsive_property 0.0.8
responsive_property: ^0.0.8 copied to clipboard
Inspired by Flutter's MaterialStateProperty, gives you a responsive value based on the current screen dimension.
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'),
),
],
),
),
),
);
}
}