Ex - 2
Ex - 2
To Develop a Simple Android Application that uses GUI Components, Font and Colors.
import 'package:flutter/material.dart';
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Simple Flutter App',
home: const MyHomePage(),
);
}
}
@override
State<MyHomePage> createState() => _MyHomePageState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Simple Flutter App')),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('Hellooo Flutter !!!', style: TextStyle(fontSize: _fontSize, color: _fontColor)),
ElevatedButton(
onPressed: () => setState(() => _fontSize = _fontSize == 20.0 ? 40.0 : 20.0),
child: const Text("Change Font Size"),
),
DropdownButton<Color>(
value: _fontColor,
onChanged: (color) => setState(() => _fontColor = color!),
items: _colors.map((color) => DropdownMenuItem(value: color, child:
Container(width: 100, height: 30, color: color))).toList(),
),
],
),
),
);
}
}
Output :