2024-09-29 18:33:19 +04:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
runApp(const MyApp());
|
|
|
|
}
|
|
|
|
|
|
|
|
class MyApp extends StatelessWidget {
|
|
|
|
const MyApp({super.key});
|
|
|
|
|
2024-10-08 18:05:02 +04:00
|
|
|
@override
|
2024-09-29 18:33:19 +04:00
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return MaterialApp(
|
2024-10-08 18:05:02 +04:00
|
|
|
title: 'My app',
|
|
|
|
debugShowCheckedModeBanner: false,
|
2024-09-29 18:33:19 +04:00
|
|
|
theme: ThemeData(
|
2024-10-08 18:05:02 +04:00
|
|
|
colorScheme: ColorScheme.fromSeed(seedColor: Colors.orangeAccent),
|
2024-09-29 18:33:19 +04:00
|
|
|
useMaterial3: true,
|
|
|
|
),
|
2024-10-08 18:05:02 +04:00
|
|
|
home: const MyHomePage(title: 'Kupi Slona'),
|
2024-09-29 18:33:19 +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-10-08 18:05:02 +04:00
|
|
|
final Color _color = Colors.deepOrange;
|
2024-09-29 18:33:19 +04:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
appBar: AppBar(
|
2024-10-08 18:05:02 +04:00
|
|
|
backgroundColor: _color,
|
|
|
|
title: Text(widget.title),
|
|
|
|
),
|
|
|
|
body: const MyWidget(),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class _CarData {
|
|
|
|
final String text;
|
|
|
|
final String descriptionCar;
|
|
|
|
final IconData icon;
|
|
|
|
final String? imageUrl;
|
|
|
|
|
|
|
|
_CarData(
|
|
|
|
this.text, {
|
|
|
|
required this.descriptionCar,
|
|
|
|
this.icon = Icons.ac_unit_outlined,
|
|
|
|
this.imageUrl,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
class MyWidget extends StatelessWidget {
|
|
|
|
const MyWidget({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
final data = [
|
|
|
|
_CarData(
|
|
|
|
'Lada Vesta',
|
|
|
|
descriptionCar: 'год: 2021\nпробег: 12000км\nвладельцев: 2',
|
|
|
|
icon: Icons.access_alarm,
|
|
|
|
imageUrl:
|
|
|
|
'https://yandex-images.clstorage.net/9mo9mr339/ee7538_C/G8eJXZRUhfuSJ9OjdqqaieLubYBOeM1UA1msI7Sd_LOgNGnS4z1IcAaQIvJeBUT1gL1zzfQzXO5c6BvSx-0aw2-jrS1VpRXfdwbz5zILb3mWX4kFSm2YIIK4yef1bn8Q9vZbcVDu-1ZFEUPWS2AAJAQJpXr1Rp2umW-b8GJJ3aE49Qla0NDF2aIH8zAEDLoLMaiecc5o37VUiZ9zkF1NwaQV-9PDnfn2hQNB9asA8XBkabeYInUdvvnMqbHSmM0C-BW4KlAANzhCx7Ii1g6YCONbDLFN-R83djoegKCerfIGlSgS4Q8rhiURsUeIE1FwpWtV60PUbB1rfapgAvsNM-sn6poQgObboRawofStC9oheC2wfaouF5aKL9Cg7cwz1jSaAoH8Onf0YMPkO2DCA4YapttDtv2fG7_pEnI6PXB6dGqYEcD3iuImQhB2jysZkzhsoO_73ScW6kwR4c3Ms4WEqqER3tgU9QHjVNijMxH3ydf7w_U9DHvvqUGz6u5iStW4-LIAxViAdIIRFTypy9HorkDt6e5m5Vg_I3BfrbKGtRgykF4bV5Ujg2TYUjCC9et1-SDGz6xavBqQooivgisluhlTAjUY0kRDkVb8iWkjW-0hPxovpxQab0OTz_ygpUVrwgFdO4Rlk8OXykLwAlda1PhDdH7_eT2qs-A6PCE4tLsa0SA2-2LEEhA1PJpKwWuMAh4I3aa22c1RYX2e0IanKZFDTgq3lcDj9FsAIUHUaBcZ0nUtDLmsqpOi6p7CC4XKuxKCp9vBRGLzBq9K2IGJ3lP-uLxF9wvM0ABNLJHXt2vzILzoVYTS80YJgvHwlTgXmGOm_mypL6hz8cl_8wjmeerAEfW78XSh8OW9eQsRmg0Sn_qvxRVrboLjbpyAB2dYEMG9SDZXwoNG2TFRklVqdDviBDxcet_bEGHIHNIIxKj4AFBXGfGWI_CW_Pp7YUudcO-I_FYGOmySUW3-8',
|
|
|
|
),
|
|
|
|
_CarData(
|
|
|
|
'Lada Granta',
|
|
|
|
descriptionCar: 'Год 2018\nпробег: 157000км\nвладельцев: 3',
|
|
|
|
icon: Icons.access_alarm,
|
|
|
|
imageUrl:
|
|
|
|
'https://avatars.mds.yandex.net/get-verba/1535139/2a00000190baa76e30188cfeae4d9b675edf/cattouchret',
|
|
|
|
),
|
|
|
|
_CarData(
|
|
|
|
'Lada Iskra',
|
|
|
|
descriptionCar: 'год 2024\nпробег: 100км\nвладельцев: 1',
|
|
|
|
icon: Icons.access_alarm,
|
|
|
|
imageUrl:
|
|
|
|
'https://s.auto.drom.ru/i24294/c/photos/fullsize/lada/iskra/lada_iskra_1205438.jpg',
|
|
|
|
),
|
|
|
|
_CarData(
|
|
|
|
'Lada Niva',
|
|
|
|
descriptionCar: 'год 2022\nпробег: 67000км\nвладельцев: 2',
|
|
|
|
icon: Icons.access_alarm,
|
|
|
|
imageUrl:
|
|
|
|
'https://avatars.mds.yandex.net/i?id=4d0abc12a692355be9dddf44bdb701b1_l-7736363-images-thumbs&n=13',
|
|
|
|
),
|
|
|
|
];
|
|
|
|
|
|
|
|
return Center(
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: data.map((e) => _Car.fromData(e)).toList(),
|
2024-09-29 18:33:19 +04:00
|
|
|
),
|
|
|
|
),
|
2024-10-08 18:05:02 +04:00
|
|
|
);
|
2024-09-29 18:33:19 +04:00
|
|
|
}
|
|
|
|
}
|
2024-10-08 18:05:02 +04:00
|
|
|
|
|
|
|
class _Car extends StatelessWidget {
|
2024-10-09 16:10:25 +04:00
|
|
|
final String TitleCar;
|
2024-10-08 18:05:02 +04:00
|
|
|
final String descriptionCar;
|
|
|
|
final IconData icon;
|
|
|
|
final String? imageUrl;
|
|
|
|
|
|
|
|
const _Car(
|
2024-10-09 16:10:25 +04:00
|
|
|
this.TitleCar, {
|
2024-10-08 18:05:02 +04:00
|
|
|
this.icon = Icons.ac_unit_outlined,
|
|
|
|
required this.descriptionCar,
|
|
|
|
this.imageUrl,
|
|
|
|
});
|
|
|
|
|
|
|
|
factory _Car.fromData(_CarData data) => _Car(
|
|
|
|
data.text,
|
|
|
|
descriptionCar: data.descriptionCar,
|
|
|
|
icon: data.icon,
|
|
|
|
imageUrl: data.imageUrl,
|
|
|
|
);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Container(
|
|
|
|
margin: const EdgeInsets.all(16),
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.white70,
|
|
|
|
borderRadius: BorderRadius.circular(20),
|
2024-10-09 16:10:25 +04:00
|
|
|
border: Border.all(color: Colors.redAccent),
|
2024-10-08 18:05:02 +04:00
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
2024-10-09 16:10:25 +04:00
|
|
|
color: Colors.deepOrange.withOpacity(.5),
|
|
|
|
spreadRadius: 5,
|
2024-10-08 18:05:02 +04:00
|
|
|
offset: const Offset(0, 5),
|
|
|
|
blurRadius: 8,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
child: Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
ClipRRect(
|
|
|
|
borderRadius: BorderRadius.circular(20),
|
|
|
|
child: SizedBox(
|
2024-10-09 16:10:25 +04:00
|
|
|
height: 150,
|
|
|
|
width: 150,
|
2024-10-08 18:05:02 +04:00
|
|
|
child: Image.network(
|
|
|
|
imageUrl ?? '',
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
errorBuilder: (_, __, ___) => const Placeholder(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.only(left: 16.0),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(
|
2024-10-09 16:10:25 +04:00
|
|
|
TitleCar,
|
2024-10-08 18:05:02 +04:00
|
|
|
style: Theme.of(context).textTheme.headlineLarge,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
descriptionCar,
|
|
|
|
style: Theme.of(context).textTheme.bodyLarge,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|