(PRAC-5)Designing the mobile app to implement the theming and styling.
import 'package:flutter/material.dart';
void main() {
runApp(
MaterialApp(
debugShowCheckedModeBanner: false,
title: "Practical 5",
theme: ThemeData(
primaryColor: Colors.deepPurple,
primarySwatch: Colors.purple,
fontFamily: 'Times New Roman',
textTheme: TextTheme(
titleLarge: TextStyle(
fontSize: 50,
fontWeight: FontWeight.bold,
color: Colors.cyan,
),
bodyMedium: TextStyle(
fontSize: 20,
fontFamily: 'Arial',
),
),
),
home: HomePage(),
),
);
}
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Home Page'),
),
body: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text('425_Devesh'),
Text(
'HeadLine',
style: Theme.of(context).textTheme.titleLarge,
),
SizedBox(height: 20),
Text('SubTitle', style: Theme.of(context).textTheme.bodyLarge),
SizedBox(height: 20),
Container(
color: Theme.of(context).primaryColor,
height: 50,
width: 50,
),
SizedBox(height: 20),
ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SecondPage(),
),
);
},
child: Text('Next Page'),
),
],
),
),
);
}
}
class SecondPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Second Page'),
),
body: Center(
child: ElevatedButton(
onPressed: () {
Navigator.pop(context);
},
child: Text('Home Page'),
),
),
);
}
}
Comments
Post a Comment