2024-11-28 01:43:55 +04:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
runApp(const MyApp());
|
|
|
|
}
|
|
|
|
|
|
|
|
class MyApp extends StatelessWidget {
|
|
|
|
const MyApp({super.key});
|
|
|
|
|
2024-12-08 19:13:46 +04:00
|
|
|
@override
|
2024-11-28 01:43:55 +04:00
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return MaterialApp(
|
|
|
|
title: 'Flutter Demo',
|
|
|
|
theme: ThemeData(
|
2024-12-08 19:13:46 +04:00
|
|
|
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
|
2024-11-28 01:43:55 +04:00
|
|
|
useMaterial3: true,
|
|
|
|
),
|
2024-12-08 19:13:46 +04:00
|
|
|
home: const MyHomePage(title: 'Yackobchuk S.V.'),
|
2024-11-28 01:43:55 +04:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class MyHomePage extends StatefulWidget {
|
|
|
|
const MyHomePage({super.key, required this.title});
|
|
|
|
|
|
|
|
final String title;
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<MyHomePage> createState() => _MyHomePageState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _MyHomePageState extends State<MyHomePage> {
|
2024-12-08 19:13:46 +04:00
|
|
|
final Color _color = Colors.orangeAccent;
|
2024-11-28 01:43:55 +04:00
|
|
|
|
2024-12-08 19:13:46 +04:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
appBar: AppBar(
|
|
|
|
backgroundColor: _color,
|
|
|
|
title: Text(widget.title),
|
|
|
|
),
|
|
|
|
body: const MyWidget(),
|
|
|
|
);
|
2024-11-28 01:43:55 +04:00
|
|
|
}
|
2024-12-08 19:13:46 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
class _CardData{
|
|
|
|
final String text;
|
|
|
|
final String descriptionText;
|
|
|
|
final IconData icon;
|
|
|
|
final String? imageUrl;
|
|
|
|
|
|
|
|
_CardData(
|
|
|
|
this.text, {
|
|
|
|
required this.descriptionText,
|
|
|
|
this.icon= Icons.ac_unit_outlined,
|
|
|
|
this.imageUrl,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
class MyWidget extends StatelessWidget {
|
|
|
|
const MyWidget({super.key}); // ключи
|
2024-11-28 01:43:55 +04:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2024-12-08 19:13:46 +04:00
|
|
|
final data = [
|
|
|
|
_CardData(
|
|
|
|
'mouse',
|
|
|
|
descriptionText: 'hahaha',
|
|
|
|
icon: Icons.abc,
|
|
|
|
imageUrl:
|
|
|
|
'https://sun34-1.userapi.com/impg/_DLT-op0LbBdgh5h-ILvC7IMDY5kbLR349v7vA/tX7vtk6mNlA.jpg?size=736x736&quality=96&sign=47f2b0f63bf249c62f4498fb637695d5&type=album'
|
2024-11-28 01:43:55 +04:00
|
|
|
),
|
2024-12-08 19:13:46 +04:00
|
|
|
_CardData(
|
|
|
|
'mouse2',
|
|
|
|
descriptionText: 'ahahaha',
|
|
|
|
icon: Icons.access_alarm_outlined,
|
|
|
|
imageUrl:
|
|
|
|
'https://sun165-1.userapi.com/impg/EVLbaLilqr8xw5tsqZLQQb6DSYrdKo7Q9sYSsw/H4FRwyMR6Ec.jpg?size=1280x960&quality=96&sign=f606e4ae3d1ccd27917cd1ffa6d91e58&type=album'
|
|
|
|
),
|
|
|
|
_CardData(
|
|
|
|
'mouse3',
|
|
|
|
descriptionText: 'eeee',
|
|
|
|
icon: Icons.access_alarm_rounded,
|
|
|
|
imageUrl:
|
|
|
|
'https://sun165-1.userapi.com/impg/Jxmp-zwq--f7KagZ6HuImLY7HrgQo-kyP1xhmw/JejdXP88_VE.jpg?size=736x981&quality=96&sign=5597f4d123422be17118ff4b1f570a9d&type=album'
|
2024-11-28 01:43:55 +04:00
|
|
|
),
|
2024-12-08 19:13:46 +04:00
|
|
|
];
|
|
|
|
|
|
|
|
return Center(
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: data.map((e) => _Card.fromData(e)).toList(),
|
|
|
|
)
|
|
|
|
),
|
|
|
|
);
|
2024-11-28 01:43:55 +04:00
|
|
|
}
|
|
|
|
}
|
2024-12-08 19:13:46 +04:00
|
|
|
|
|
|
|
class _Card extends StatelessWidget {
|
|
|
|
final String text;
|
|
|
|
final String descriptionText;
|
|
|
|
final IconData icon;
|
|
|
|
final String? imageUrl;
|
|
|
|
|
|
|
|
const _Card(
|
|
|
|
this.text, {
|
|
|
|
this.icon = Icons.ac_unit_outlined,
|
|
|
|
required this.descriptionText,
|
|
|
|
this.imageUrl,
|
|
|
|
});
|
|
|
|
|
|
|
|
factory _Card.fromData(_CardData data) => _Card(
|
|
|
|
data.text,
|
|
|
|
descriptionText: data.descriptionText,
|
|
|
|
icon: data.icon,
|
|
|
|
imageUrl: data.imageUrl,
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Container(
|
|
|
|
margin: const EdgeInsets.only(top: 16),
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.orangeAccent,
|
|
|
|
borderRadius: BorderRadius.circular(20),
|
|
|
|
border: Border.all(
|
|
|
|
color: Colors.black12,
|
|
|
|
width: 2
|
|
|
|
)
|
|
|
|
),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
children: [
|
|
|
|
SizedBox(
|
|
|
|
height: 140,
|
|
|
|
width: 100,
|
|
|
|
child: Image.network(
|
|
|
|
imageUrl ?? '',
|
|
|
|
errorBuilder: (_, __, ___) => const Placeholder(),
|
|
|
|
)
|
|
|
|
),
|
|
|
|
Expanded (
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.only(left: 8.0),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
text,
|
|
|
|
style: Theme.of(context).textTheme.headlineLarge,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
descriptionText,
|
|
|
|
style: Theme.of(context).textTheme.bodyLarge,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const Spacer(),
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.only(left: 8.0),
|
|
|
|
child: Icon(icon),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|