ConstrainedBox

 import "package:flutter/material.dart";


void main() {
runApp(MyApp(),);
}
class MyApp extends StatelessWidget {
MyApp({super.key});

@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: "Constraint Box in Flutter",
theme: ThemeData(
primarySwatch: Colors.brown,
),
home: ConstraintBoxDemo(),
);
}
}
class ConstraintBoxDemo extends StatelessWidget {
ConstraintBoxDemo({super.key});

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Constraint Box"),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ConstrainedBox(
constraints: BoxConstraints(
maxWidth: 200,
maxHeight: 100,
),
child: Text("Use ListTile, a specialized row widget from the Material library, for an easy way to create a row "
"containing up to 3 lines of text and optional leading and trailing icons.",
style: TextStyle(fontSize: 21,),
overflow: TextOverflow.fade,
),
),
ConstrainedBox(
constraints: BoxConstraints(
maxWidth: 300,
minWidth: 200,
minHeight: 100,
maxHeight: 300,
),
child: ElevatedButton(
onPressed: (){},
child: Text("Click Here!"),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.indigo,
),
),
),
],
),
),
);
}
}

Comments

Popular posts from this blog

Pagination with Bloc Pattern in Flutter

Pagination First Practical in Flutter

ExpansionPanel with ExpansionPanelList with Complete Collapse Operation in Flutter