flutter_size 0.0.1 flutter_size: ^0.0.1 copied to clipboard
Get Size Of different types of widgets
Language: English
You can get size From BuildContext size and also size form Layout Builder Box Constraints size
Get started #
Add dependency #
dependencies:
flutter_size: ^4.0.6
Super simple to use #
import 'package:flutter_size/get_size.dart';
class GetSize extends StatefulWidget {
const GetSize({Key? key}) : super(key: key);
@override
State<GetSize> createState() => _GetSizeState();
}
class _GetSizeState extends State<GetSize> {
@override
Widget build(BuildContext context) {
return Center(child : Container(
width : context.getWidth(0.3),
height : context.getHeight(0.9),
),
);
}
}
Examples #
import 'package:flutter_size/get_size.dart';
class GetSize extends StatefulWidget {
const GetSize({Key? key}) : super(key: key);
@override
State<GetSize> createState() => _GetSizeState();
}
class _GetSizeState extends State<GetSize> {
@override
Widget build(BuildContext context) {
return Center(child : Container(
width : context.getDeviceWidth,
height : context.getDeviceHeight,
),
);
}
}