Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
814b671fa4 | |||
6b17730aef | |||
435eaf4944 |
110
lib/main.dart
110
lib/main.dart
@ -12,7 +12,7 @@ class MyApp extends StatelessWidget {
|
|||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
title: 'Flutter Demo',
|
title: 'Flutter Demo',
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
primarySwatch: Colors.blue,
|
primarySwatch: Colors.amber,
|
||||||
),
|
),
|
||||||
home: const MyHomePage(title: 'Flutter Demo Home Page'),
|
home: const MyHomePage(title: 'Flutter Demo Home Page'),
|
||||||
);
|
);
|
||||||
@ -42,25 +42,103 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text("Кувшинов Тимур Александрович"),
|
title: Text("Кувшинов Тимур Александрович"),
|
||||||
|
backgroundColor: Colors.amber,
|
||||||
),
|
),
|
||||||
body: Center(
|
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(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: data.map((e) => _Card.fromData(e)).toList(),
|
||||||
const Text(
|
|
||||||
'You have pushed the button this many times:',
|
|
||||||
),
|
),
|
||||||
Text(
|
),
|
||||||
'$_counter',
|
);
|
||||||
style: Theme.of(context).textTheme.headlineLarge,
|
}
|
||||||
),
|
}
|
||||||
],
|
|
||||||
),
|
class _CardData {
|
||||||
),
|
final String text;
|
||||||
floatingActionButton: FloatingActionButton(
|
final String? imageUrl;
|
||||||
onPressed: _incrementCounter,
|
|
||||||
tooltip: 'Increment',
|
_CardData(
|
||||||
child: const Icon(Icons.add),
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user