PIbd-31_MasenkinMS_PMU/lib/main.dart

74 lines
1.6 KiB
Dart
Raw Normal View History

2024-09-13 00:51:36 +04:00
import 'dart:math';
2024-09-10 01:32:13 +04:00
import 'package:flutter/material.dart';
2024-09-13 00:51:36 +04:00
import 'comments_widget.dart';
2024-09-10 01:32:13 +04:00
void main() {
2024-09-13 00:51:36 +04:00
runApp(const MyApp());
2024-09-10 01:32:13 +04:00
}
class MyApp extends StatelessWidget {
2024-09-13 00:51:36 +04:00
const MyApp({super.key});
2024-09-10 01:32:13 +04:00
@override
Widget build(BuildContext context) {
return MaterialApp(
2024-09-13 00:51:36 +04:00
title: 'Comments App',
2024-09-10 02:00:11 +04:00
debugShowCheckedModeBanner: false,
2024-09-10 01:32:13 +04:00
theme: ThemeData(
2024-09-13 00:51:36 +04:00
colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
useMaterial3: true,
),
home: const MyHomePage(title: 'Comments App'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
Color _color = Colors.transparent;
@override
void initState() {
super.initState();
_color = Color((Random().nextDouble() * 0xFFFFFF).toInt()).withOpacity(1.0);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: _color,
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget.title,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
)),
Text(
'made by Factorino',
style: TextStyle(
fontSize: 12,
fontStyle: FontStyle.italic,
),
),
],
),
2024-09-10 01:41:34 +04:00
),
2024-09-13 00:51:36 +04:00
body: const CommentsWidget(),
2024-09-10 01:32:13 +04:00
);
}
}