Skip to content

Commit

Permalink
Merge pull request #30 from msi-se/main
Browse files Browse the repository at this point in the history
merge main into fastlane branch
  • Loading branch information
johannesbrandenburger authored Mar 1, 2024
2 parents 585ac2f + 4e57439 commit 1f36d9b
Show file tree
Hide file tree
Showing 21 changed files with 2,143 additions and 1,210 deletions.
1 change: 1 addition & 0 deletions frontend/lib/components/choose/choose_course.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class _ChooseCourseState extends State<ChooseCourse> {
),
elevation: 1.0,
surfaceTintColor: Colors.white,
clipBehavior: Clip.antiAlias,
child: ListTile(
title: Text(widget.courses[index].name),
subtitle: Text(widget.courses[index].description),
Expand Down
59 changes: 35 additions & 24 deletions frontend/lib/components/choose/choose_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,36 +32,46 @@ class _ChooseFormState extends State<ChooseForm> {
collapsable: true,
expandedTitleScale: 1,
title: (percentage) {
return Align(
alignment: Alignment.centerLeft,
child: Padding(
padding:
EdgeInsets.only(left: 16, right: percentage < 0.2 ? 0 : 120),
child: Text(
widget.course.name,
style: TextStyle(
color: colors.onSurface,
fontWeight: FontWeight.bold,
return LayoutBuilder(
builder: (context, constraints) {
final isNarrow = constraints.maxWidth < 360;
return Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: EdgeInsets.only(
left: 16,
right: percentage < 0.2 || isNarrow ? 0 : 120,
),
child: Text(
widget.course.name,
style: TextStyle(
color: colors.onSurface,
fontWeight: FontWeight.bold,
fontSize: 16,
),
overflow: TextOverflow.ellipsis,
),
),
),
),
);
},
);
},
// round button in Background with "Moodle"
background: Padding(
padding: const EdgeInsets.only(right: 20),
child: Align(
alignment: Alignment.centerRight,
child: ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0),
),
padding: const EdgeInsets.only(right: 20),
child: Align(
alignment: Alignment.centerRight,
child: ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0),
),
child: Image.asset(moodleLogo, width: 80),
),
)),
child: Image.asset(moodleLogo, width: 80),
),
),
),

body: Column(
children: [
Row(
Expand Down Expand Up @@ -150,6 +160,7 @@ class _ChooseFormState extends State<ChooseForm> {
),
elevation: 1.0,
surfaceTintColor: Colors.white,
clipBehavior: Clip.antiAlias,
child: ListTile(
title: Text(forms[index].name),
subtitle: Text(forms[index].description),
Expand Down
116 changes: 66 additions & 50 deletions frontend/lib/components/dashboard_card.dart
Original file line number Diff line number Diff line change
@@ -1,65 +1,81 @@
import 'package:flutter/material.dart';
import 'package:frontend/theme/assets.dart';
import 'package:flutter_svg/flutter_svg.dart';

class MyCard extends StatelessWidget {
final Color cardColor;
final String title;
final String imageName;
final String route;
class DashboardCard extends StatefulWidget {
final String svgImage;
final String text;
final VoidCallback onTap;

const MyCard({
const DashboardCard({
Key? key,
required this.title,
required this.cardColor,
required this.imageName,
required this.route,
required this.svgImage,
required this.text,
required this.onTap,
}) : super(key: key);

@override
State<DashboardCard> createState() => _DashboardCardState();
}

class _DashboardCardState extends State<DashboardCard> with SingleTickerProviderStateMixin {
late AnimationController _controller;
late Animation<double> _animation;

@override
void initState() {
super.initState();
_controller = AnimationController(
duration: const Duration(milliseconds: 400),
vsync: this,
);

_animation = CurvedAnimation(
parent: _controller,
curve: Curves.easeOut,
);

_controller.forward();
}

@override
Widget build(BuildContext context) {
return InkWell(
onTap: () {
Navigator.pushNamed(context, route);
},
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 15),
return GestureDetector(
onTap: widget.onTap,
child: ScaleTransition(
scale: _animation,
child: Container(
margin: const EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25),
color: cardColor,
boxShadow: const [
BoxShadow(
color: Colors.grey,
spreadRadius: 1,
blurRadius: 3,
)
],
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
title,
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Colors.black,
),
textAlign: TextAlign.center,
decoration: BoxDecoration(
color: const Color(0xffd9e5ec),
borderRadius: BorderRadius.circular(24),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SvgPicture.asset(
widget.svgImage,
height: 110,
width: 110,
),
const SizedBox(height: 8),
Text(
widget.text,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
const SizedBox(height: 5),
Align(
alignment: Alignment.center,
child: SvgPicture.asset(
imageName,
height: 80,
width: 80,
))
],
)),
),
],
),
),
),
);
}

@override
void dispose() {
_controller.dispose();
super.dispose();
}
}

Loading

0 comments on commit 1f36d9b

Please sign in to comment.