146 lines
3.8 KiB
Dart
146 lines
3.8 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(
|
|
primarySwatch: Colors.amber,
|
|
),
|
|
home: const MyHomePage(title: 'Flutter Demo Home Page'),
|
|
);
|
|
}
|
|
}
|
|
|
|
class MyHomePage extends StatefulWidget {
|
|
const MyHomePage({super.key, required this.title});
|
|
|
|
final String title;
|
|
|
|
@override
|
|
State<MyHomePage> createState() => _MyHomePageState();
|
|
}
|
|
|
|
class _MyHomePageState extends State<MyHomePage> {
|
|
int _counter = 0;
|
|
|
|
void _incrementCounter() {
|
|
setState(() {
|
|
_counter++;
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: Text("Кувшинов Тимур Александрович"),
|
|
backgroundColor: Colors.amber,
|
|
),
|
|
backgroundColor: Colors.yellow,
|
|
body: const MyWidget());
|
|
}
|
|
}
|
|
|
|
class MyWidget extends StatelessWidget {
|
|
const MyWidget({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final List<_CardData> data = [
|
|
_CardData('orange', imageUrl: 'https://kuban24.tv/wp-content/uploads/2023/10/photo_2023-10-02_16-08-02.jpg'),
|
|
_CardData("aboba", imageUrl: 'https://masterpiecer-images.s3.yandex.net/5fa453a2d4c51a7:upscaled'),
|
|
_CardData("Hello world!!!", imageUrl: 'https://m.media-amazon.com/images/I/81YqUbAZ0GL._AC_UF1000,1000_QL80_.jpg'),
|
|
_CardData('(=^・^=)',
|
|
imageUrl:
|
|
'https://i.pinimg.com/236x/c8/cc/24/c8cc24bba37a25c009647b8875aae0e3.jpg'),
|
|
_CardData('плохо быть старым ' + 'трезвым и больным, ' * 5,
|
|
imageUrl: 'https://images.genius.com/c754c6f1755acee741881d55985a6c34.865x865x1.jpg'
|
|
),
|
|
];
|
|
|
|
return Center(
|
|
child: SingleChildScrollView(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: data.map((e) => _Card.fromData(e)).toList(),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _CardData {
|
|
final String text;
|
|
final String? imageUrl;
|
|
|
|
_CardData(
|
|
this.text, {
|
|
this.imageUrl,
|
|
});
|
|
}
|
|
|
|
class _Card extends StatelessWidget {
|
|
final String _text;
|
|
final String? imageUrl;
|
|
|
|
const _Card(this._text, {Key? key, this.imageUrl}) : super(key: key);
|
|
|
|
factory _Card.fromData(_CardData data) => _Card(
|
|
data.text,
|
|
imageUrl: data.imageUrl,
|
|
);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
padding: const EdgeInsets.all(10),
|
|
margin: const EdgeInsets.all(10),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(20),
|
|
color: Colors.amber,
|
|
border: Border.all(color: Colors.amberAccent, width: 2),
|
|
boxShadow: [BoxShadow(
|
|
color: Colors.grey.withOpacity(.5),
|
|
blurRadius: 8,
|
|
offset: const Offset(0, 5),
|
|
spreadRadius: 4,
|
|
)]
|
|
),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
ClipRRect(
|
|
borderRadius: const BorderRadius.horizontal(left: Radius.circular(150), right: Radius.circular(30)),
|
|
child: SizedBox(
|
|
height: 160,
|
|
width: 90,
|
|
child: Image.network(
|
|
imageUrl ?? '',
|
|
fit: BoxFit.cover,
|
|
errorBuilder: (_, __, ___) => const Placeholder(),
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Text(
|
|
_text,
|
|
style: Theme.of(context).textTheme.headlineLarge,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|