import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Welcome to Flutter',
home: Body()
);
}
}
class Body extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Flutter Height and Width in Percent'),
),
body: Center(
child: SizedBox(
width: MediaQuery
.of(context)
.size
.width * 0.5,
height: MediaQuery
.of(context)
.size
.height * 0.1,
child: RaisedButton(
onPressed: () {},
child: const Text(
'Button in Percent!', style: TextStyle(fontSize: 20)),
color: Colors.blue,
textColor: Colors.white,
elevation: 5,
)
)
),
);
}
}
Wednesday, May 12, 2021
【FLUTTER ANDROID STUDIO and IOS】Specify Height and Width in Percent with respect to the screen
Subscribe to:
Post Comments (Atom)
-
Hi again reader -- Welcome to Day 2 of 5 Bake-from-Scratch Secrets! Have you ever been intimidated to bake cupc...
-
When Christmas rolls around, gingerbread treats are one of the most popular to both bake and consume. And there's no better a...
No comments:
Post a Comment