From 435eaf4944699eba966ed43f0b16141b8f02fc53 Mon Sep 17 00:00:00 2001 From: Timourka Date: Sun, 29 Sep 2024 01:21:02 +0400 Subject: [PATCH] =?UTF-8?q?lol=20=D1=81=D0=BA=D0=BE=D0=BF=D0=B8=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BB=20=D0=B8=D0=B7=20=D0=BB=D0=B5=D0=BA?= =?UTF-8?q?=D1=86=D0=B8=D0=B8=20=D0=BD=D0=BE=20=D1=82=D0=B0=D0=BA=20=D0=BA?= =?UTF-8?q?=D0=B0=D0=BA=20=D0=BC=D0=BD=D0=B5=20=D0=B7=D0=B0=D1=85=D0=BE?= =?UTF-8?q?=D1=82=D0=B5=D0=BB=D0=BE=D1=81=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/main.dart | 113 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 95 insertions(+), 18 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 19c7261..67c669d 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -12,7 +12,7 @@ class MyApp extends StatelessWidget { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( - primarySwatch: Colors.blue, + primarySwatch: Colors.amber, ), home: const MyHomePage(title: 'Flutter Demo Home Page'), ); @@ -40,28 +40,105 @@ class _MyHomePageState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBar( - title: Text("Кувшинов Тимур Александрович"), + appBar: AppBar( + title: Text("Кувшинов Тимур Александрович"), + ), + 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' ), - body: Center( + ]; + + return Center( + child: SingleChildScrollView( child: Column( mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Text( - 'You have pushed the button this many times:', - ), - Text( - '$_counter', - style: Theme.of(context).textTheme.headline4, - ), - ], + children: data.map((e) => _Card.fromData(e)).toList(), ), ), - floatingActionButton: FloatingActionButton( - onPressed: _incrementCounter, - tooltip: 'Increment', - child: const Icon(Icons.add), - ), + ); + } +} + +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, + ), + ), + ), + ], + ), ); } }