MIH window Arch enhancement
This commit is contained in:
@@ -3,15 +3,15 @@ import 'package:patient_manager/main.dart';
|
|||||||
|
|
||||||
class MIHWindow extends StatefulWidget {
|
class MIHWindow extends StatefulWidget {
|
||||||
final String windowTitle;
|
final String windowTitle;
|
||||||
final List<Widget> windowItems;
|
final List<Widget> windowBody;
|
||||||
final List<Widget>? actionItems;
|
final List<Widget> windowTools;
|
||||||
final void Function() onTapClose;
|
final void Function() onWindowTapClose;
|
||||||
const MIHWindow({
|
const MIHWindow({
|
||||||
super.key,
|
super.key,
|
||||||
required this.windowTitle,
|
required this.windowTitle,
|
||||||
required this.windowItems,
|
required this.windowBody,
|
||||||
required this.actionItems,
|
required this.windowTools,
|
||||||
required this.onTapClose,
|
required this.onWindowTapClose,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -49,13 +49,37 @@ class _MIHWindowState extends State<MIHWindow> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> getWindowItems() {
|
Widget getWidnowClose() {
|
||||||
List<Widget> temp = [];
|
return Row(
|
||||||
temp.add(const SizedBox(height: 10));
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
temp.add(
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
SizedBox(
|
children: [
|
||||||
width: windowWidth - 150,
|
IconButton(
|
||||||
child: Text(
|
onPressed: widget.onWindowTapClose,
|
||||||
|
icon: Icon(
|
||||||
|
Icons.close,
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.errorColor(),
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget getWidnowTools() {
|
||||||
|
return Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: widget.windowTools,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget getWidnowTitle() {
|
||||||
|
return Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
widget.windowTitle,
|
widget.windowTitle,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
@@ -65,19 +89,41 @@ class _MIHWindowState extends State<MIHWindow> {
|
|||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
);
|
);
|
||||||
if (MzanziInnovationHub.of(context)!.theme.screenType == "desktop") {
|
|
||||||
temp.addAll(widget.windowItems);
|
|
||||||
return temp;
|
|
||||||
} else {
|
|
||||||
//temp.add(const SizedBox(height: 25));
|
|
||||||
temp.addAll(widget.windowItems);
|
|
||||||
return temp;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget windowPopUp() {
|
Widget getWidnowHeader() {
|
||||||
|
return Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 2,
|
||||||
|
child: getWidnowTools(),
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
flex: 2,
|
||||||
|
child: getWidnowTitle(),
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
flex: 2,
|
||||||
|
child: getWidnowClose(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget getWidnowBody() {
|
||||||
|
return Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: widget.windowBody,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget createWindow(Widget header, Widget body) {
|
||||||
return Dialog(
|
return Dialog(
|
||||||
insetPadding: EdgeInsets.symmetric(
|
insetPadding: EdgeInsets.symmetric(
|
||||||
horizontal: horizontralWindowPadding,
|
horizontal: horizontralWindowPadding,
|
||||||
@@ -85,51 +131,26 @@ class _MIHWindowState extends State<MIHWindow> {
|
|||||||
),
|
),
|
||||||
insetAnimationCurve: Easing.emphasizedDecelerate,
|
insetAnimationCurve: Easing.emphasizedDecelerate,
|
||||||
insetAnimationDuration: Durations.short1,
|
insetAnimationDuration: Durations.short1,
|
||||||
child: Stack(
|
child: Container(
|
||||||
children: [
|
//padding: const EdgeInsets.all(10),
|
||||||
Container(
|
width: windowWidth,
|
||||||
//padding: const EdgeInsets.all(10),
|
//height: windowHeight,
|
||||||
width: windowWidth,
|
decoration: BoxDecoration(
|
||||||
//height: windowHeight,
|
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
decoration: BoxDecoration(
|
borderRadius: BorderRadius.circular(25.0),
|
||||||
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
border: Border.all(
|
||||||
borderRadius: BorderRadius.circular(25.0),
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
border: Border.all(
|
width: 5.0),
|
||||||
color:
|
),
|
||||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
child: Padding(
|
||||||
width: 5.0),
|
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||||
),
|
child: Column(
|
||||||
child: Column(
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisSize: MainAxisSize.min,
|
children: [header, body],
|
||||||
children: getWindowItems(),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Positioned(
|
),
|
||||||
top: 5,
|
|
||||||
right: 5,
|
|
||||||
height: 50,
|
|
||||||
child: IconButton(
|
|
||||||
onPressed: widget.onTapClose,
|
|
||||||
icon: Icon(
|
|
||||||
Icons.close,
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.errorColor(),
|
|
||||||
size: 35,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
top: 5,
|
|
||||||
left: 5,
|
|
||||||
height: 50,
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: widget.actionItems!,
|
|
||||||
)),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -152,6 +173,9 @@ class _MIHWindowState extends State<MIHWindow> {
|
|||||||
height = size.height;
|
height = size.height;
|
||||||
});
|
});
|
||||||
checkScreenSize();
|
checkScreenSize();
|
||||||
return windowPopUp();
|
return createWindow(
|
||||||
|
getWidnowHeader(),
|
||||||
|
getWidnowBody(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user