lab3-lection
This commit is contained in:
parent
238f2e555f
commit
d912a9656b
@ -1,4 +1,3 @@
|
|||||||
import 'CourseStatus.dart';
|
|
||||||
import 'Student.dart';
|
import 'Student.dart';
|
||||||
|
|
||||||
extension StudentCourseStatus on Student {
|
extension StudentCourseStatus on Student {
|
||||||
|
104
lib/main.dart
104
lib/main.dart
@ -1,5 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'CourseStatus.dart';
|
|
||||||
import 'University.dart';
|
import 'University.dart';
|
||||||
import 'student.dart';
|
import 'student.dart';
|
||||||
|
|
||||||
@ -53,7 +52,8 @@ class _UniversityScreenState extends State<UniversityScreen> {
|
|||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text('Строев Владимир, ПИбд-32'),
|
title: Text('Строев Владимир, ПИбд-32'),
|
||||||
),
|
),
|
||||||
body: Column(
|
body: const MyWidget()
|
||||||
|
/*Column(
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
@ -120,6 +120,106 @@ class _UniversityScreenState extends State<UniversityScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
)*/,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user