Update window widget
This commit is contained in:
@@ -35,15 +35,13 @@ class _MihAppTileState extends State<MihAppTile> {
|
|||||||
return MihAppWindow(
|
return MihAppWindow(
|
||||||
fullscreen: false,
|
fullscreen: false,
|
||||||
windowTitle: widget.appName,
|
windowTitle: widget.appName,
|
||||||
windowTools: const [],
|
// windowTools: const [],
|
||||||
onWindowTapClose: () {
|
onWindowTapClose: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
windowBody: [
|
windowBody: MIHYTVideoPlayer(
|
||||||
MIHYTVideoPlayer(
|
videoYTLink: widget.ytVideoID!,
|
||||||
videoYTLink: widget.ytVideoID!,
|
),
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import '../../main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
|
|
||||||
class MihAppWindow extends StatefulWidget {
|
class MihAppWindow extends StatefulWidget {
|
||||||
final String windowTitle;
|
final String windowTitle;
|
||||||
final List<Widget> windowBody;
|
final Widget windowBody;
|
||||||
final List<Widget> windowTools;
|
final Widget? windowTools;
|
||||||
|
// final List<SpeedDialChild> menuOptions;
|
||||||
final void Function() onWindowTapClose;
|
final void Function() onWindowTapClose;
|
||||||
final bool fullscreen;
|
final bool fullscreen;
|
||||||
const MihAppWindow({
|
const MihAppWindow({
|
||||||
super.key,
|
super.key,
|
||||||
required this.fullscreen,
|
required this.fullscreen,
|
||||||
required this.windowTitle,
|
required this.windowTitle,
|
||||||
required this.windowTools,
|
this.windowTools,
|
||||||
|
// required this.menuOptions,
|
||||||
required this.onWindowTapClose,
|
required this.onWindowTapClose,
|
||||||
required this.windowBody,
|
required this.windowBody,
|
||||||
});
|
});
|
||||||
@@ -51,139 +53,45 @@ class _MihAppWindowState extends State<MihAppWindow> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget getWidnowClose() {
|
Widget getWindowHeader() {
|
||||||
return Container(
|
return Container(
|
||||||
alignment: Alignment.centerRight,
|
// color: Colors.green,
|
||||||
child: IconButton(
|
alignment: Alignment.center,
|
||||||
onPressed: widget.onWindowTapClose,
|
height: 50,
|
||||||
icon: Icon(
|
child: Row(
|
||||||
Icons.close,
|
children: [
|
||||||
color: MzanziInnovationHub.of(context)!.theme.errorColor(),
|
widget.windowTools != null ? widget.windowTools! : Container(),
|
||||||
size: 35,
|
Expanded(
|
||||||
),
|
child: Container(
|
||||||
),
|
padding: EdgeInsets.symmetric(horizontal: 15),
|
||||||
);
|
// color: Colors.pink,
|
||||||
}
|
child: Text(
|
||||||
|
widget.windowTitle,
|
||||||
Widget getWidnowTools() {
|
textAlign: TextAlign.left,
|
||||||
return Row(
|
style: TextStyle(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
fontSize: windowTitleSize,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
fontWeight: FontWeight.bold,
|
||||||
mainAxisSize: MainAxisSize.max,
|
color:
|
||||||
children: widget.windowTools,
|
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
);
|
),
|
||||||
}
|
),
|
||||||
|
|
||||||
Widget getWidnowTitle() {
|
|
||||||
return Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: Text(
|
|
||||||
widget.windowTitle,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
|
||||||
fontSize: windowTitleSize,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
Container(
|
||||||
],
|
// color: Colors.white,
|
||||||
);
|
alignment: Alignment.center,
|
||||||
}
|
child: IconButton(
|
||||||
|
iconSize: 35,
|
||||||
Widget getWidnowHeader() {
|
onPressed: () {
|
||||||
return Row(
|
widget.onWindowTapClose();
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
},
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
icon: Icon(
|
||||||
mainAxisSize: MainAxisSize.max,
|
Icons.close,
|
||||||
children: [
|
color: MzanziInnovationHub.of(context)!.theme.errorColor(),
|
||||||
getWidnowTools(),
|
),
|
||||||
Expanded(
|
),
|
||||||
flex: 2,
|
|
||||||
child: getWidnowTitle(),
|
|
||||||
),
|
|
||||||
getWidnowClose(),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget getWidnowBody() {
|
|
||||||
if (widget.fullscreen) {
|
|
||||||
return Expanded(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(10.0),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: widget.windowBody,
|
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.all(10.0),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: widget.windowBody,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget createWindow(Widget header, Widget body) {
|
|
||||||
Widget visibleItems;
|
|
||||||
if (widget.fullscreen) {
|
|
||||||
visibleItems = Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
header,
|
|
||||||
//const Divider(),
|
|
||||||
body,
|
|
||||||
],
|
],
|
||||||
);
|
|
||||||
} else {
|
|
||||||
visibleItems = SingleChildScrollView(
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
header,
|
|
||||||
//const Divider(),
|
|
||||||
body,
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return Dialog(
|
|
||||||
insetPadding: EdgeInsets.symmetric(
|
|
||||||
horizontal: horizontralWindowPadding,
|
|
||||||
vertical: vertticalWindowPadding,
|
|
||||||
),
|
|
||||||
insetAnimationCurve: Easing.emphasizedDecelerate,
|
|
||||||
insetAnimationDuration: Durations.short1,
|
|
||||||
child: Container(
|
|
||||||
//padding: const EdgeInsets.all(10),
|
|
||||||
width: windowWidth,
|
|
||||||
//height: windowHeight,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
borderRadius: BorderRadius.circular(25.0),
|
|
||||||
border: Border.all(
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
|
||||||
width: 5.0),
|
|
||||||
),
|
|
||||||
child: visibleItems,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -206,9 +114,43 @@ class _MihAppWindowState extends State<MihAppWindow> {
|
|||||||
height = size.height;
|
height = size.height;
|
||||||
});
|
});
|
||||||
checkScreenSize();
|
checkScreenSize();
|
||||||
return createWindow(
|
return Dialog(
|
||||||
getWidnowHeader(),
|
insetPadding: EdgeInsets.symmetric(
|
||||||
getWidnowBody(),
|
horizontal: horizontralWindowPadding,
|
||||||
|
vertical: vertticalWindowPadding,
|
||||||
|
),
|
||||||
|
insetAnimationCurve: Easing.emphasizedDecelerate,
|
||||||
|
insetAnimationDuration: Durations.short1,
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
borderRadius: BorderRadius.circular(25.0),
|
||||||
|
border: Border.all(
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
width: 5.0),
|
||||||
|
),
|
||||||
|
child: widget.fullscreen
|
||||||
|
? Column(
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
children: [
|
||||||
|
getWindowHeader(),
|
||||||
|
Expanded(child: widget.windowBody),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
getWindowHeader(),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 15,
|
||||||
|
right: 15,
|
||||||
|
bottom: 15,
|
||||||
|
),
|
||||||
|
child: widget.windowBody),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,11 +5,13 @@ import 'package:mzansi_innovation_hub/main.dart';
|
|||||||
class MihFloatingMenu extends StatefulWidget {
|
class MihFloatingMenu extends StatefulWidget {
|
||||||
final IconData? icon;
|
final IconData? icon;
|
||||||
final AnimatedIconData? animatedIcon;
|
final AnimatedIconData? animatedIcon;
|
||||||
|
final SpeedDialDirection? direction;
|
||||||
final List<SpeedDialChild> children;
|
final List<SpeedDialChild> children;
|
||||||
const MihFloatingMenu({
|
const MihFloatingMenu({
|
||||||
super.key,
|
super.key,
|
||||||
this.icon,
|
this.icon,
|
||||||
this.animatedIcon,
|
this.animatedIcon,
|
||||||
|
this.direction,
|
||||||
required this.children,
|
required this.children,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -28,6 +30,7 @@ class _MihFloatingMenuState extends State<MihFloatingMenu> {
|
|||||||
child: SpeedDial(
|
child: SpeedDial(
|
||||||
icon: widget.icon,
|
icon: widget.icon,
|
||||||
animatedIcon: widget.animatedIcon,
|
animatedIcon: widget.animatedIcon,
|
||||||
|
direction: widget.direction ?? SpeedDialDirection.up,
|
||||||
activeIcon: Icons.close,
|
activeIcon: Icons.close,
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
|||||||
@@ -1,14 +1,10 @@
|
|||||||
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_single_child_scroll.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_app.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_app.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_app_action.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_app_action.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_app_alert.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_app_alert.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_app_tools.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_app_tools.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_app_window.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/test/package_tools/package_tool_one.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih-app_tool_body.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/test/package_tools/package_tool_two.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_floating_menu.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_objects/arguments.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/arguments.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
@@ -38,12 +34,12 @@ class _PackageTestState extends State<PackageTest> {
|
|||||||
|
|
||||||
MihAppTools getTools() {
|
MihAppTools getTools() {
|
||||||
Map<Widget, void Function()?> temp = Map();
|
Map<Widget, void Function()?> temp = Map();
|
||||||
temp[const Icon(Icons.arrow_back)] = () {
|
temp[const Icon(Icons.inbox)] = () {
|
||||||
setState(() {
|
setState(() {
|
||||||
_selcetedIndex = 0;
|
_selcetedIndex = 0;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
temp[const Icon(Icons.arrow_forward)] = () {
|
temp[const Icon(Icons.outbond)] = () {
|
||||||
setState(() {
|
setState(() {
|
||||||
_selcetedIndex = 1;
|
_selcetedIndex = 1;
|
||||||
});
|
});
|
||||||
@@ -113,134 +109,10 @@ class _PackageTestState extends State<PackageTest> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void showFullScreenWindow() {
|
List<Widget> getToolBody() {
|
||||||
showDialog(
|
List<Widget> toolBodies = [
|
||||||
context: context,
|
const PackageToolOne(),
|
||||||
builder: (context) {
|
const PackageToolTwo(),
|
||||||
return MihAppWindow(
|
|
||||||
fullscreen: true,
|
|
||||||
windowTitle: "Test",
|
|
||||||
windowTools: const [],
|
|
||||||
onWindowTapClose: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
windowBody: [
|
|
||||||
Text(
|
|
||||||
"Window test",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void showNormalWindow() {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return MihAppWindow(
|
|
||||||
fullscreen: false,
|
|
||||||
windowTitle: "Test",
|
|
||||||
windowTools: const [],
|
|
||||||
onWindowTapClose: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
windowBody: [
|
|
||||||
Text(
|
|
||||||
"Window test",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<MihAppToolBody> getToolBody() {
|
|
||||||
List<MihAppToolBody> toolBodies = [
|
|
||||||
MihAppToolBody(
|
|
||||||
borderOn: true,
|
|
||||||
bodyItem: MihSingleChildScroll(
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Hello",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 25,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
color:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
MihFloatingMenu(children: [
|
|
||||||
SpeedDialChild(
|
|
||||||
child: Icon(
|
|
||||||
Icons.add,
|
|
||||||
color:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
),
|
|
||||||
label: "Add",
|
|
||||||
labelBackgroundColor:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
|
||||||
labelStyle: TextStyle(
|
|
||||||
color:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
),
|
|
||||||
backgroundColor:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
|
||||||
onTap: () {},
|
|
||||||
)
|
|
||||||
]),
|
|
||||||
Container(
|
|
||||||
color: Colors.black,
|
|
||||||
width: 200,
|
|
||||||
height: 200,
|
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: IconButton.filled(
|
|
||||||
onPressed: () {},
|
|
||||||
icon: Icon(
|
|
||||||
MihIcons.mihLogo,
|
|
||||||
color:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
MihAppToolBody(
|
|
||||||
borderOn: false,
|
|
||||||
bodyItem: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"World!!!",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 25,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
];
|
];
|
||||||
return toolBodies;
|
return toolBodies;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_single_child_scroll.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_single_child_scroll.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih-app_tool_body.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih-app_tool_body.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_app_window.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_floating_menu.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
|
||||||
|
|
||||||
class PackageToolOne extends StatefulWidget {
|
class PackageToolOne extends StatefulWidget {
|
||||||
@@ -12,6 +15,40 @@ class PackageToolOne extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _PackageToolOneState extends State<PackageToolOne> {
|
class _PackageToolOneState extends State<PackageToolOne> {
|
||||||
|
void showTestFullWindow() {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
barrierDismissible: false,
|
||||||
|
builder: (context) {
|
||||||
|
return MihAppWindow(
|
||||||
|
fullscreen: true,
|
||||||
|
windowTitle: "Test Full",
|
||||||
|
onWindowTapClose: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
windowBody: Text("Testing Window Body"),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void showTestWindow() {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
barrierDismissible: false,
|
||||||
|
builder: (context) {
|
||||||
|
return MihAppWindow(
|
||||||
|
fullscreen: false,
|
||||||
|
windowTitle: "Test No Full",
|
||||||
|
onWindowTapClose: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
windowBody: Text("Testing Window Body"),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MihAppToolBody(
|
return MihAppToolBody(
|
||||||
@@ -21,40 +58,98 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget getBody() {
|
Widget getBody() {
|
||||||
return MihAppToolBody(
|
return Stack(
|
||||||
borderOn: true,
|
children: [
|
||||||
bodyItem: MihSingleChildScroll(
|
MihSingleChildScroll(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
mainAxisSize: MainAxisSize.max,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
mainAxisSize: MainAxisSize.max,
|
||||||
Text(
|
children: [
|
||||||
"Hello",
|
Row(
|
||||||
textAlign: TextAlign.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
style: TextStyle(
|
children: [
|
||||||
fontSize: 25,
|
Text(
|
||||||
fontWeight: FontWeight.bold,
|
"Hello",
|
||||||
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 25,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: MzanziInnovationHub.of(context)!
|
||||||
|
.theme
|
||||||
|
.secondaryColor(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 10),
|
||||||
const SizedBox(height: 10),
|
Container(
|
||||||
Container(
|
color: Colors.black,
|
||||||
color: Colors.black,
|
width: 200,
|
||||||
width: 200,
|
height: 200,
|
||||||
height: 200,
|
padding: EdgeInsets.zero,
|
||||||
padding: EdgeInsets.zero,
|
alignment: Alignment.center,
|
||||||
alignment: Alignment.center,
|
child: IconButton.filled(
|
||||||
child: IconButton.filled(
|
onPressed: () {},
|
||||||
onPressed: () {},
|
icon: Icon(
|
||||||
icon: Icon(
|
MihIcons.mihLogo,
|
||||||
MihIcons.mihLogo,
|
color:
|
||||||
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
)
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
Positioned(
|
||||||
|
right: 0,
|
||||||
|
bottom: 0,
|
||||||
|
child: MihFloatingMenu(
|
||||||
|
animatedIcon: AnimatedIcons.menu_close,
|
||||||
|
children: [
|
||||||
|
SpeedDialChild(
|
||||||
|
child: Icon(
|
||||||
|
Icons.add,
|
||||||
|
color:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
),
|
||||||
|
label: "Show New Window",
|
||||||
|
labelBackgroundColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.successColor(),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
color:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
backgroundColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.successColor(),
|
||||||
|
onTap: () {
|
||||||
|
showTestWindow();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SpeedDialChild(
|
||||||
|
child: Icon(
|
||||||
|
Icons.add,
|
||||||
|
color:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
),
|
||||||
|
label: "Show New Full Window",
|
||||||
|
labelBackgroundColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.successColor(),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
color:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
backgroundColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.successColor(),
|
||||||
|
onTap: () {
|
||||||
|
showTestFullWindow();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_single_child_scroll.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih-app_tool_body.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
|
||||||
|
|
||||||
|
class PackageToolTwo extends StatefulWidget {
|
||||||
|
const PackageToolTwo({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<PackageToolTwo> createState() => _PackageToolTwoState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PackageToolTwoState extends State<PackageToolTwo> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return MihAppToolBody(
|
||||||
|
borderOn: false,
|
||||||
|
bodyItem: getBody(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget getBody() {
|
||||||
|
return MihSingleChildScroll(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"World",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 25,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Container(
|
||||||
|
color: Colors.black,
|
||||||
|
width: 200,
|
||||||
|
height: 200,
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: IconButton.filled(
|
||||||
|
onPressed: () {},
|
||||||
|
icon: Icon(
|
||||||
|
MihIcons.mihLogo,
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -126,132 +126,141 @@ class _AiChatState extends State<AiChat> {
|
|||||||
return MihAppWindow(
|
return MihAppWindow(
|
||||||
fullscreen: false,
|
fullscreen: false,
|
||||||
windowTitle: 'Mzansi AI Thoughts',
|
windowTitle: 'Mzansi AI Thoughts',
|
||||||
windowTools: [
|
windowTools: Row(
|
||||||
Visibility(
|
children: [
|
||||||
visible: _aiThinking == false,
|
Visibility(
|
||||||
child: Padding(
|
visible: _aiThinking == false,
|
||||||
padding: const EdgeInsets.all(5.0),
|
child: Padding(
|
||||||
child: Container(
|
padding: const EdgeInsets.all(5.0),
|
||||||
//color: MzanziInnovationHub.of(context)!.theme.successColor(),
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
//color: MzanziInnovationHub.of(context)!.theme.successColor(),
|
||||||
color:
|
decoration: BoxDecoration(
|
||||||
MzanziInnovationHub.of(context)!.theme.successColor(),
|
color: MzanziInnovationHub.of(context)!
|
||||||
borderRadius: const BorderRadius.all(
|
.theme
|
||||||
Radius.circular(100),
|
.successColor(),
|
||||||
|
borderRadius: const BorderRadius.all(
|
||||||
|
Radius.circular(100),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
child: IconButton(
|
||||||
child: IconButton(
|
color: MzanziInnovationHub.of(context)!
|
||||||
color:
|
.theme
|
||||||
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
.primaryColor(),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
print("Start TTS now");
|
print("Start TTS now");
|
||||||
|
|
||||||
_speakText(snapshot.requireData);
|
_speakText(snapshot.requireData);
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.volume_up),
|
icon: const Icon(Icons.volume_up),
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Visibility(
|
|
||||||
visible: _aiThinking == true,
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(5.0),
|
|
||||||
child: Container(
|
|
||||||
// color: MzanziInnovationHub.of(context)!.theme.errorColor(),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.errorColor(),
|
|
||||||
borderRadius: const BorderRadius.all(
|
|
||||||
Radius.circular(100),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: IconButton(
|
),
|
||||||
color:
|
),
|
||||||
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
Visibility(
|
||||||
onPressed: () {
|
visible: _aiThinking == true,
|
||||||
//print("Start TTS now");
|
child: Padding(
|
||||||
_flutterTts.stop();
|
padding: const EdgeInsets.all(5.0),
|
||||||
},
|
child: Container(
|
||||||
icon: const Icon(Icons.volume_off),
|
// color: MzanziInnovationHub.of(context)!.theme.errorColor(),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.errorColor(),
|
||||||
|
borderRadius: const BorderRadius.all(
|
||||||
|
Radius.circular(100),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: IconButton(
|
||||||
|
color: MzanziInnovationHub.of(context)!
|
||||||
|
.theme
|
||||||
|
.primaryColor(),
|
||||||
|
onPressed: () {
|
||||||
|
//print("Start TTS now");
|
||||||
|
_flutterTts.stop();
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.volume_off),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
onWindowTapClose: () {
|
onWindowTapClose: () {
|
||||||
_captureAIResponse(snapshot.requireData);
|
_captureAIResponse(snapshot.requireData);
|
||||||
_flutterTts.stop();
|
_flutterTts.stop();
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
windowBody: [
|
windowBody: Column(
|
||||||
Stack(
|
children: [
|
||||||
children: [
|
Stack(
|
||||||
Text(
|
children: [
|
||||||
snapshot.requireData,
|
Column(
|
||||||
textAlign: TextAlign.left,
|
children: [
|
||||||
style: TextStyle(
|
Text(
|
||||||
color: MzanziInnovationHub.of(context)!
|
snapshot.requireData,
|
||||||
.theme
|
textAlign: TextAlign.left,
|
||||||
.secondaryColor(),
|
style: TextStyle(
|
||||||
fontSize: _chatFrontSize,
|
color: MzanziInnovationHub.of(context)!
|
||||||
fontWeight: FontWeight.bold,
|
.theme
|
||||||
),
|
.secondaryColor(),
|
||||||
),
|
fontSize: _chatFrontSize,
|
||||||
Positioned(
|
fontWeight: FontWeight.bold,
|
||||||
bottom: 0,
|
),
|
||||||
right: 0,
|
|
||||||
child: Visibility(
|
|
||||||
visible: _aiThinking == false,
|
|
||||||
child: IconButton.filled(
|
|
||||||
iconSize: 25,
|
|
||||||
autofocus: true,
|
|
||||||
onPressed: () {
|
|
||||||
_captureAIResponse(snapshot.requireData);
|
|
||||||
_flutterTts.stop();
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
focusColor: MzanziInnovationHub.of(context)!
|
|
||||||
.theme
|
|
||||||
.successColor(),
|
|
||||||
icon: Icon(
|
|
||||||
Icons.check,
|
|
||||||
color: MzanziInnovationHub.of(context)!
|
|
||||||
.theme
|
|
||||||
.primaryColor(),
|
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
|
|
||||||
// MIHButton(
|
|
||||||
// onTap: () {
|
|
||||||
// _captureAIResponse(snapshot.requireData);
|
|
||||||
// Navigator.of(context).pop();
|
|
||||||
// },
|
|
||||||
// buttonText: "Continue",
|
|
||||||
// buttonColor: MzanziInnovationHub.of(context)!
|
|
||||||
// .theme
|
|
||||||
// .successColor(),
|
|
||||||
// textColor: MzanziInnovationHub.of(context)!
|
|
||||||
// .theme
|
|
||||||
// .primaryColor(),
|
|
||||||
// ),
|
|
||||||
),
|
),
|
||||||
),
|
Positioned(
|
||||||
],
|
bottom: 0,
|
||||||
),
|
right: 0,
|
||||||
],
|
child: Visibility(
|
||||||
|
visible: _aiThinking == false,
|
||||||
|
child: IconButton.filled(
|
||||||
|
iconSize: 25,
|
||||||
|
autofocus: true,
|
||||||
|
onPressed: () {
|
||||||
|
_captureAIResponse(snapshot.requireData);
|
||||||
|
_flutterTts.stop();
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
focusColor: MzanziInnovationHub.of(context)!
|
||||||
|
.theme
|
||||||
|
.successColor(),
|
||||||
|
icon: Icon(
|
||||||
|
Icons.check,
|
||||||
|
color: MzanziInnovationHub.of(context)!
|
||||||
|
.theme
|
||||||
|
.primaryColor(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// MIHButton(
|
||||||
|
// onTap: () {
|
||||||
|
// _captureAIResponse(snapshot.requireData);
|
||||||
|
// Navigator.of(context).pop();
|
||||||
|
// },
|
||||||
|
// buttonText: "Continue",
|
||||||
|
// buttonColor: MzanziInnovationHub.of(context)!
|
||||||
|
// .theme
|
||||||
|
// .successColor(),
|
||||||
|
// textColor: MzanziInnovationHub.of(context)!
|
||||||
|
// .theme
|
||||||
|
// .primaryColor(),
|
||||||
|
// ),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return MihAppWindow(
|
return MihAppWindow(
|
||||||
fullscreen: false,
|
fullscreen: false,
|
||||||
windowTitle: 'Mzansi AI Thoughts',
|
windowTitle: 'Mzansi AI Thoughts',
|
||||||
windowTools: [],
|
// windowTools: [],
|
||||||
onWindowTapClose: () {
|
onWindowTapClose: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
windowBody: const [
|
windowBody: Mihloadingcircle(),
|
||||||
Mihloadingcircle(),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user