PIbd-31_MasenkinMS_PMU/lib/main.dart

74 lines
1.6 KiB
Dart

import 'dart:math';
import 'package:flutter/material.dart';
import 'comments_widget.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Comments App',
debugShowCheckedModeBanner: false,
theme: ThemeData(
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,
),
),
],
),
),
body: const CommentsWidget(),
);
}
}