diff --git a/Frontend/lib/mih_components/mih_package_components/mih_app.dart b/Frontend/lib/mih_components/mih_package_components/mih_app.dart index de3fa772..aff69b0f 100644 --- a/Frontend/lib/mih_components/mih_package_components/mih_app.dart +++ b/Frontend/lib/mih_components/mih_package_components/mih_app.dart @@ -101,7 +101,7 @@ class _MihAppState extends State with SingleTickerProviderStateMixin { drawer: widget.actionDrawer, body: SafeArea( bottom: false, - minimum: EdgeInsets.only(bottom: 5), + minimum: EdgeInsets.only(bottom: 0), child: Container( width: screenSize.width, height: screenSize.height, diff --git a/Frontend/lib/mih_components/mih_profile_picture.dart b/Frontend/lib/mih_components/mih_profile_picture.dart deleted file mode 100644 index e23d68d4..00000000 --- a/Frontend/lib/mih_components/mih_profile_picture.dart +++ /dev/null @@ -1,160 +0,0 @@ -import 'dart:io'; - -import 'package:file_picker/file_picker.dart'; -import 'package:flutter/material.dart'; -import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart'; -import '../../main.dart'; - -// ignore: must_be_immutable -class MIHProfilePicture extends StatefulWidget { - final ImageProvider? profilePictureFile; - final TextEditingController proPicController; - - PlatformFile? proPic; - final double width; - final double radius; - final bool drawerMode; - final bool editable; - final Color frameColor; - final onChange; - - MIHProfilePicture({ - super.key, - required this.profilePictureFile, - required this.proPicController, - required this.proPic, - required this.width, - required this.radius, - required this.drawerMode, - required this.editable, - required this.onChange, - required this.frameColor, - }); - - @override - State createState() => _MIHProfilePictureState(); -} - -class _MIHProfilePictureState extends State { - late ImageProvider? propicPreview; - - Widget displayEditableProPic() { - if (widget.profilePictureFile != null) { - return Stack( - alignment: Alignment.center, - fit: StackFit.loose, - children: [ - CircleAvatar( - backgroundColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - backgroundImage: propicPreview, - //'https://media.licdn.com/dms/image/D4D03AQGd1-QhjtWWpA/profile-displayphoto-shrink_400_400/0/1671698053061?e=2147483647&v=beta&t=a3dJI5yxs5-KeXjj10LcNCFuC9IOfa8nNn3k_Qyr0CA'), - radius: widget.radius, - ), - SizedBox( - width: widget.width, - child: FittedBox( - fit: BoxFit.fill, - child: Icon( - MihIcons.mihCircleFrame, - color: widget.frameColor, - ), - ), - ), - Visibility( - visible: widget.editable, - child: Positioned( - bottom: 0, - right: 0, - child: IconButton.filled( - onPressed: () async { - try { - // print( - // "Platform: ${MzanziInnovationHub.of(context)!.theme.getPlatform()}"); - FilePickerResult? result = - await FilePicker.platform.pickFiles( - type: FileType.image, - ); - - if (MzanziInnovationHub.of(context)!.theme.getPlatform() == - "Web") { - if (result == null) return; - final selectedFile = result.files.first; - setState(() { - widget.onChange(selectedFile); - widget.proPic = selectedFile; - //print("MIH Profile Picture: ${widget.proPic}"); - propicPreview = MemoryImage(widget.proPic!.bytes!); - }); - - setState(() { - widget.proPicController.text = selectedFile.name; - }); - } else { - // print( - // "================\nHere for Android & IOS\n========================"); - if (result != null) { - // print("here 1"); - File file = File(result.files.single.path!); - PlatformFile? androidFile = PlatformFile( - path: file.path, - name: file.path.split('/').last, - size: file.lengthSync(), - bytes: await file.readAsBytes(), // Read file bytes - //extension: fileExtension, - ); - // print("here 2"); - setState(() { - // print("here 3"); - widget.onChange(androidFile); - // print("here 4"); - widget.proPic = androidFile; - // print("here 5"); - //print("MIH Profile Picture: ${widget.proPic}"); - //print("bytes: ${widget.proPic!.bytes!}"); - propicPreview = FileImage(file); - }); - - setState(() { - widget.proPicController.text = widget.proPic!.name; - }); - } else { - print("here in else"); - // User canceled the picker - } - } - } catch (e) { - print("Error: $e"); - } - }, - icon: const Icon(Icons.edit), - ), - ), - ), - ], - ); - } else { - return SizedBox( - width: widget.width, - child: Icon( - MihIcons.mihCircleFrame, - color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), - ), - ); - } - } - - @override - void initState() { - setState(() { - propicPreview = widget.profilePictureFile; - }); - - super.initState(); - } - - @override - Widget build(BuildContext context) { - return displayEditableProPic(); - } -} diff --git a/Frontend/lib/mih_packages/mih_home/mih_home_legacy.dart b/Frontend/lib/mih_packages/mih_home/mih_home_legacy.dart index 9f5c79c4..20dab3ff 100644 --- a/Frontend/lib/mih_packages/mih_home/mih_home_legacy.dart +++ b/Frontend/lib/mih_packages/mih_home/mih_home_legacy.dart @@ -28,7 +28,6 @@ import '../../mih_components/mih_pop_up_messages/mih_loading_circle.dart'; import '../../mih_components/mih_pop_up_messages/mih_notification_message.dart'; import '../../mih_components/mih_pop_up_messages/mih_success_message.dart'; import '../../mih_components/mih_pop_up_messages/mih_warning_message.dart'; -import '../../mih_components/mih_profile_picture.dart'; import '../../mih_env/env.dart'; import '../../mih_objects/app_user.dart'; import '../../mih_objects/arguments.dart'; @@ -985,18 +984,18 @@ class _MIHHomeLegacyState extends State { return Builder(builder: (context) { return MIHAction( icon: Padding( - padding: const EdgeInsets.only(left: 5.0), - child: MIHProfilePicture( - profilePictureFile: widget.propicFile, - proPicController: proPicController, - proPic: null, - width: 45, - radius: 21, - drawerMode: false, - editable: false, - frameColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(), - onChange: (newProPic) {}, - ), + padding: const EdgeInsets.only(left: 5.0), child: Placeholder(), + // MIHProfilePicture( + // profilePictureFile: widget.propicFile, + // proPicController: proPicController, + // proPic: null, + // width: 45, + // radius: 21, + // drawerMode: false, + // editable: false, + // frameColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(), + // onChange: (newProPic) {}, + // ), ), // const Icon(Icons.apps), iconSize: 45, diff --git a/Frontend/lib/mih_packages/mih_home/package_tools/mih_business_home.dart b/Frontend/lib/mih_packages/mih_home/package_tools/mih_business_home.dart index b6a09d23..938bc8e6 100644 --- a/Frontend/lib/mih_packages/mih_home/package_tools/mih_business_home.dart +++ b/Frontend/lib/mih_packages/mih_home/package_tools/mih_business_home.dart @@ -190,7 +190,7 @@ class _MihBusinessHomeState extends State final double width = size.width; final double height = size.height; return MihAppToolBody( - borderOn: true, + borderOn: false, bodyItem: getBody(width, height), ); } diff --git a/Frontend/lib/mih_packages/mih_home/package_tools/mih_personal_home.dart b/Frontend/lib/mih_packages/mih_home/package_tools/mih_personal_home.dart index 80d9d87d..7c613000 100644 --- a/Frontend/lib/mih_packages/mih_home/package_tools/mih_personal_home.dart +++ b/Frontend/lib/mih_packages/mih_home/package_tools/mih_personal_home.dart @@ -157,12 +157,9 @@ class _MihPersonalHomeState extends State ); }, appName: "Test", - appIcon: Container( - padding: const EdgeInsets.all(0.5), - child: Icon( - Icons.warning_amber_rounded, - color: MzanziInnovationHub.of(context)!.theme.primaryColor(), - ), + appIcon: Icon( + Icons.warning_amber_rounded, + color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), ), iconSize: packageSize, primaryColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(), @@ -238,7 +235,7 @@ class _MihPersonalHomeState extends State final double height = size.height; return MihAppToolBody( - borderOn: true, + borderOn: false, bodyItem: getBody(width, height), ); } diff --git a/Frontend/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_profile.dart b/Frontend/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_profile.dart index c18edbf6..7bf2186b 100644 --- a/Frontend/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_profile.dart +++ b/Frontend/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_profile.dart @@ -9,10 +9,10 @@ import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_ import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_text_input.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_circle_avatar.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_error_message.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_success_message.dart'; -import 'package:mzansi_innovation_hub/mih_components/mih_profile_picture.dart'; import 'package:mzansi_innovation_hub/mih_env/env.dart'; import 'package:mzansi_innovation_hub/mih_objects/arguments.dart'; import 'package:file_picker/file_picker.dart'; @@ -350,13 +350,11 @@ class _MihBusinessProfileState extends State { ?.theme .secondaryColor()), const SizedBox(height: 10.0), - MIHProfilePicture( - profilePictureFile: logoPreview, - proPicController: logonameController, - proPic: logoFile, + MihCircleAvatar( + imageFile: logoPreview, + fileNameController: logonameController, + userSelectedfile: logoFile, width: 155, - radius: 70, - drawerMode: false, editable: true, frameColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(), @@ -366,6 +364,8 @@ class _MihBusinessProfileState extends State { }); print("logoFile: ${logoFile?.bytes}"); }, + backgroundColor: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), ), const SizedBox(height: 10.0), MIHFileField(