105 lines
2.3 KiB
Dart
105 lines
2.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
void main() {
|
|
runApp(const MyApp());
|
|
}
|
|
|
|
class MyApp extends StatelessWidget {
|
|
const MyApp({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
title: 'Flutter Demo',
|
|
theme: ThemeData(
|
|
colorScheme: ColorScheme.fromSeed(seedColor: Colors.indigoAccent),
|
|
useMaterial3: true,
|
|
),
|
|
home: const MyHomePage(title: 'Валова Анна Дмитриевна'),
|
|
);
|
|
}
|
|
}
|
|
|
|
class MyHomePage extends StatefulWidget {
|
|
const MyHomePage({super.key, required this.title});
|
|
|
|
final String title;
|
|
|
|
@override
|
|
State<MyHomePage> createState() => _MyHomePageState();
|
|
}
|
|
|
|
class _MyHomePageState extends State<MyHomePage> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
|
title: Text(widget.title),
|
|
),
|
|
body: const MyWidget(),
|
|
);
|
|
}
|
|
}
|
|
|
|
class MyWidget extends StatelessWidget {
|
|
const MyWidget({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return const Center(
|
|
child: SingleChildScrollView(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
_Card("Hello1", translation: "desc"),
|
|
_Card("Hello1", translation: "desc"),
|
|
_Card("Hello", translation: "desc"),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _Card extends StatelessWidget {
|
|
final String word;
|
|
final String translation;
|
|
final IconData icon;
|
|
|
|
const _Card(
|
|
this.word, {
|
|
required this.translation,
|
|
this.icon = Icons.abc,
|
|
});
|
|
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
padding: const EdgeInsets.all(20),
|
|
margin: const EdgeInsets.all(10),
|
|
decoration: BoxDecoration(
|
|
color: Colors.amberAccent,
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
child: Column(
|
|
children: [
|
|
Text(
|
|
word,
|
|
style: Theme.of(context).textTheme.headlineLarge,
|
|
),
|
|
Text(
|
|
translation,
|
|
style: Theme.of(context).textTheme.bodySmall,
|
|
),
|
|
Icon(
|
|
icon,
|
|
size: 50,
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|