FractionallySizedBox Widget in Flutter

 import "package:flutter/material.dart";

import "package:sdreatech_learning_widget/All_widgets_Ui/customWidget.dart";

void main() {
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
const MyApp({super.key});

@override
Widget build(BuildContext context) {
return MaterialApp(
title: "Fractionally SizedBox",
debugShowCheckedModeBanner: false,
theme: ThemeData(
appBarTheme: const AppBarTheme(
backgroundColor: Colors.grey,
centerTitle: true,
),
),
home: FractionallySizedBoxWidgetPractice(),
);
}
}

class FractionallySizedBoxWidgetPractice extends StatelessWidget {
const FractionallySizedBoxWidgetPractice({super.key});

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: UiHelper.customAppBar("Fractionally SizedBox"),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
FractionallySizedBox(
widthFactor: 0.9,
child: ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
backgroundColor: Colors.blue,
),
child: const Text(
"Click Me",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20.0,
color: Colors.white),
),
),
),
const SizedBox(height: 20.0),
Container(
height: 200.0,
color: Colors.orange,
),
Flexible(
child: FractionallySizedBox(
heightFactor: 0.2,
),
),
Container(
height: 200.0,
color: Colors.brown,
),
],
),
),
);
}
}


Comments

Popular posts from this blog

Second GET API Calling with Bloc simple Example in Flutter

Stack Container Scrollable Card widget UI with Custom Widget

Pagination with Bloc Pattern in Flutter