Skip to content

Commit

Permalink
Modal Widget (#1298)
Browse files Browse the repository at this point in the history
  • Loading branch information
DGoiana authored Aug 21, 2024
2 parents 43aab39 + 00bff18 commit d5328c0
Show file tree
Hide file tree
Showing 8 changed files with 210 additions and 0 deletions.
28 changes: 28 additions & 0 deletions packages/uni_ui/lib/modal/modal.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import 'package:figma_squircle/figma_squircle.dart';
import 'package:flutter/material.dart';

class ModalDialog extends StatelessWidget {
const ModalDialog({
required this.children,
});

final List<Widget> children;

@override
Widget build(BuildContext context) {
return Dialog(
backgroundColor: Colors.transparent,
child: ClipSmoothRect(
radius: SmoothBorderRadius(cornerRadius: 30, cornerSmoothing: 1),
child: Container(
padding: const EdgeInsets.all(20.0),
color: Theme.of(context).colorScheme.surface,
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: children,
),
)),
);
}
}
57 changes: 57 additions & 0 deletions packages/uni_ui/lib/modal/widgets/enrollment_info.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import 'package:flutter/material.dart';
import 'package:uni_ui/theme.dart';

class ModalEnrollementInfo extends StatelessWidget {
const ModalEnrollementInfo({required this.enrollements});

final Map<String, String> enrollements;

@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.only(top: 10.0),
width: double.infinity,
decoration: BoxDecoration(
border: Border(
top: BorderSide(
color: Theme.of(context).dividerColor, width: 1))),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Enrollments", style: Theme.of(context).textTheme.bodyMedium),
Wrap(
spacing: 1,
direction: Axis.horizontal,
children: enrollements.entries.map((entry) {
return Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(entry.key,
style: Theme.of(context)
.textTheme
.labelLarge
?.copyWith(
color: Theme.of(context).primaryColor)),
Container(
padding: const EdgeInsets.all(4.0),
margin: const EdgeInsets.all(3.0),
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(20)),
color: Theme.of(context).primaryColor),
child: Text(
entry.value,
style: Theme.of(context)
.textTheme
.labelSmall
?.copyWith(
color: pureWhite,
),
))
],
);
}).toList())
],
));
}
}
45 changes: 45 additions & 0 deletions packages/uni_ui/lib/modal/widgets/info_row.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import 'package:flutter/material.dart';
import 'package:phosphor_flutter/phosphor_flutter.dart';

class ModalInfoRow extends StatelessWidget {
const ModalInfoRow(
{super.key,
required this.title,
required this.description,
required this.icon,
this.onPressed});

final String title;
final String description;
final IconData icon;
final void Function()? onPressed;

@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(3.0),
decoration: BoxDecoration(
border: Border(
top: BorderSide(
color: Theme.of(context).dividerColor, width: 1))),
child: Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: Theme.of(context).textTheme.bodyMedium,
),
Text(description,
style: Theme.of(context).textTheme.bodySmall!.copyWith(
color: Theme.of(context).secondaryHeaderColor)),
],
),
),
IconButton(onPressed: onPressed, icon: PhosphorIcon(icon))
],
));
}
}
28 changes: 28 additions & 0 deletions packages/uni_ui/lib/modal/widgets/person_info.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import 'package:flutter/material.dart';

class ModalPersonInfo extends StatelessWidget {
const ModalPersonInfo({this.image, required this.name});

final Image? image;
final String name;

@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.only(bottom: 20.0),
child: Column(
children: [
CircleAvatar(
radius: 60.0,
backgroundImage: image?.image,
backgroundColor: Colors.green,
),
Text(
name,
style: Theme.of(context).textTheme.displaySmall,
)
],
),
);
}
}
42 changes: 42 additions & 0 deletions packages/uni_ui/lib/modal/widgets/service_info.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import 'package:flutter/material.dart';
import 'package:phosphor_flutter/phosphor_flutter.dart';
import 'package:uni_ui/theme.dart';

class ModalServiceInfo extends StatelessWidget {
const ModalServiceInfo({required this.name, required this.durations});

final String name;
final List<String> durations;

@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.only(bottom: 20.0),
child: Column(
children: [
Text(
name,
style: TextStyle(
fontSize: 25.0, color: Theme.of(context).primaryColor),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
PhosphorIcon(
PhosphorIcons.clock(PhosphorIconsStyle.duotone),
color: darkGray,
duotoneSecondaryColor: normalGray,
),
Column(
children: durations.map((duration) {
return Text(duration,
style: Theme.of(context).textTheme.bodySmall!.copyWith(
color: Theme.of(context).secondaryHeaderColor));
}).toList(),
)
],
),
],
));
}
}
1 change: 1 addition & 0 deletions packages/uni_ui/lib/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@ ThemeData lightTheme = ThemeData(
dividerColor: lightGray,
hintColor: lightGray,
indicatorColor: darkRed,
secondaryHeaderColor: normalGray,
iconTheme: const IconThemeData(color: darkRed),
);
8 changes: 8 additions & 0 deletions packages/uni_ui/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.9.0"
phosphor_flutter:
dependency: "direct main"
description:
name: phosphor_flutter
sha256: "8a14f238f28a0b54842c5a4dc20676598dd4811fcba284ed828bd5a262c11fde"
url: "https://pub.dev"
source: hosted
version: "2.1.0"
pool:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions packages/uni_ui/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies:
figma_squircle: ^0.5.3
flutter:
sdk: flutter
phosphor_flutter: ^2.1.0

dev_dependencies:
custom_lint: ^0.6.4
Expand Down

0 comments on commit d5328c0

Please sign in to comment.