main.dart
import 'package:flutter/material.dart';
void main() {
runApp(
MaterialApp(
theme: ThemeData(primarySwatch: Colors.indigo),
home: Scaffold(
appBar: AppBar(
title: const Text("Flutter - SizedBox Square")
),
body: bodyContent(),
backgroundColor: Colors.indigo.shade50
)
)
);
}
bodyContent(){
return Center(
child: SizedBox.square(
dimension: 100,
child: ElevatedButton(
onPressed: (){},
child: const Text("Click Me")
)
)
);
}
More flutter tutorials
- flutter – Button width match parent
- flutter – SizedBox expand
- flutter – SizedBox from size
- flutter – SizedBox shrink
- flutter – How to use ConstrainedBox
- flutter – ConstrainedBox color
- flutter – ConstrainedBox padding
- flutter – BoxDecoration shadow
- flutter – BoxDecoration circle
- flutter – BoxDecoration shape
- flutter – FittedBox alignment
- flutter – How to use Flexible
- flutter – How to wrap text
- flutter – Container clip behavior
- flutter – How to use InkResponse