diff --git a/lib/ExtensionStudent.dart b/lib/ExtensionStudent.dart index 1a0a349..12206d5 100644 --- a/lib/ExtensionStudent.dart +++ b/lib/ExtensionStudent.dart @@ -1,4 +1,3 @@ -import 'CourseStatus.dart'; import 'Student.dart'; extension StudentCourseStatus on Student { diff --git a/lib/main.dart b/lib/main.dart index a1a5431..11d0c31 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'CourseStatus.dart'; import 'University.dart'; import 'student.dart'; @@ -53,7 +52,8 @@ class _UniversityScreenState extends State { appBar: AppBar( title: Text('Строев Владимир, ПИбд-32'), ), - body: Column( + body: const MyWidget() + /*Column( children: [ Padding( padding: const EdgeInsets.all(8.0), @@ -120,7 +120,107 @@ class _UniversityScreenState extends State { ), ), ], + )*/, + ); + } +} + +class MyWidget extends StatelessWidget { + const MyWidget ({super.key}); + + @override + Widget build(BuildContext context) { + final data = [ + _CardData( + text: "Hello", + icon: Icons.warning_amber, + descriptionText: "mumumu"), + _CardData( + text: 'H', + descriptionText: "pupupu",), + _CardData( + text: "LLo", + icon: Icons.dangerous, + descriptionText: "kukuku"), + ]; + return Center( + child:SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: data.map((e) => _Card.fromData(e)).toList(), + ), + ) + ); + } +} + +class _CardData{ + final String text; + final IconData icon; + final String descriptionText; + final String? imageUrl; + + _CardData({required this.text, + this.icon = Icons.ac_unit_outlined, + required this.descriptionText, + this.imageUrl,}); +} + +class _Card extends StatelessWidget { + final String text; + final IconData icon; + final String descriptionText; + final String? imageUrl; + + const _Card(this.text, { + this.icon = Icons.ac_unit_outlined, + required this.descriptionText, + this.imageUrl = 'https://distribution.faceit-cdn.net/images/679409f5-2896-4942-b976-62f5d31bd9eb.jpeg', + }); + + factory _Card.fromData(_CardData data) => _Card(data.text, + icon: data.icon, + descriptionText: data.descriptionText); + + @override + Widget build(BuildContext context) { + return Container( + margin: const EdgeInsets.only(top: 16), + decoration: BoxDecoration( + color: Colors.orangeAccent, + borderRadius: BorderRadius.circular(20), + ), + padding: const EdgeInsets.all(16), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + ClipRRect( + borderRadius: BorderRadius.circular(20), + child: SizedBox( + height: 140, + width: 100, + child: Image.network(imageUrl ?? '', + fit: BoxFit.cover, + errorBuilder: (_, __, ___) => const Placeholder(),), + ), + ), + Flexible( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(text, style: Theme.of(context).textTheme.headlineLarge + ), + Text(descriptionText, style: Theme.of(context).textTheme.bodyLarge) + ], + ), + ), + Padding( + padding: const EdgeInsets.only(left: 8.0), + child: Icon(icon), + ), + ], ), ); } -} \ No newline at end of file +}