profile links display enhancement
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/profile_link.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@@ -9,11 +8,11 @@ import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class MihProfileLinks extends StatefulWidget {
|
||||
final List<ProfileLink> links;
|
||||
final bool? paddingOn;
|
||||
final double? buttonSize;
|
||||
const MihProfileLinks({
|
||||
super.key,
|
||||
required this.links,
|
||||
this.paddingOn,
|
||||
this.buttonSize,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -76,11 +75,12 @@ class _MihProfileLinksState extends State<MihProfileLinks> {
|
||||
break;
|
||||
default:
|
||||
iconData = FontAwesomeIcons.link;
|
||||
btnColor = MihColors.primary();
|
||||
btnColor = MihColors.secondary();
|
||||
iconColor = Colors.black;
|
||||
}
|
||||
return MihButton(
|
||||
width: 80,
|
||||
height: 80,
|
||||
width: widget.buttonSize ?? 70,
|
||||
height: widget.buttonSize ?? 70,
|
||||
onPressed: () {
|
||||
launchSocialUrl(Uri.parse(link.web_link));
|
||||
},
|
||||
@@ -115,39 +115,37 @@ class _MihProfileLinksState extends State<MihProfileLinks> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double width = MediaQuery.of(context).size.width;
|
||||
// double width = MediaQuery.of(context).size.width;
|
||||
return Consumer<MzansiProfileProvider>(
|
||||
builder: (BuildContext context, MzansiProfileProvider profileProvider,
|
||||
Widget? child) {
|
||||
return Padding(
|
||||
padding: widget.paddingOn == null || widget.paddingOn!
|
||||
? MzansiInnovationHub.of(context)!.theme.screenType == "desktop"
|
||||
? EdgeInsets.symmetric(horizontal: width * 0.2)
|
||||
: EdgeInsets.symmetric(horizontal: width * 0)
|
||||
: EdgeInsetsGeometry.all(0),
|
||||
child: widget.links.isEmpty
|
||||
? SizedBox(
|
||||
height: 35,
|
||||
child: Text(
|
||||
"No Profile Links",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.primary(),
|
||||
),
|
||||
),
|
||||
)
|
||||
: Wrap(
|
||||
alignment: WrapAlignment.center,
|
||||
runSpacing: 10,
|
||||
spacing: 10,
|
||||
children: widget.links.map(
|
||||
(link) {
|
||||
return displayLinkButton(link);
|
||||
},
|
||||
).toList(),
|
||||
),
|
||||
// return widget.links.isEmpty
|
||||
// ? SizedBox(
|
||||
// height: 35,
|
||||
// child: Text(
|
||||
// "No Links Added",
|
||||
// textAlign: TextAlign.center,
|
||||
// style: TextStyle(
|
||||
// fontSize: 25,
|
||||
// fontWeight: FontWeight.bold,
|
||||
// color: MihColors.secondary(),
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// :
|
||||
return Column(
|
||||
children: [
|
||||
Wrap(
|
||||
alignment: WrapAlignment.center,
|
||||
runSpacing: 10,
|
||||
spacing: 10,
|
||||
children: widget.links.map(
|
||||
(link) {
|
||||
return displayLinkButton(link);
|
||||
},
|
||||
).toList(),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
+42
-30
@@ -4,6 +4,7 @@ import 'package:mih_package_toolkit/mih_package_toolkit.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/profile_link.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_profile_links.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/personal_profile/components/mih_edit_personal_profile_window.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@@ -33,6 +34,7 @@ class _MihPersonalProfileState extends State<MihPersonalProfile> {
|
||||
}
|
||||
|
||||
List<ProfileLink> getTempLinks() {
|
||||
// return [];
|
||||
return [
|
||||
ProfileLink(
|
||||
idprofile_links: 1,
|
||||
@@ -242,36 +244,46 @@ class _MihPersonalProfileState extends State<MihPersonalProfile> {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 15.0),
|
||||
// Stack(
|
||||
// children: [
|
||||
// MihProfileLinks(
|
||||
// // links: mzansiProfileProvider.personalLinks,
|
||||
// links: getTempLinks(),
|
||||
// buttonSize: 80,
|
||||
// paddingOn: false,
|
||||
// ),
|
||||
// Positioned(
|
||||
// top: 5,
|
||||
// left: 5,
|
||||
// child: MihButton(
|
||||
// onPressed: () {
|
||||
// editProfileWindow(width);
|
||||
// },
|
||||
// buttonColor: MihColors.green(
|
||||
// MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
// "Dark"),
|
||||
// width: 35,
|
||||
// height: 35,
|
||||
// child: Icon(
|
||||
// Icons.link,
|
||||
// color: MihColors.primary(
|
||||
// MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
// "Dark"),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
MihProfileLinks(
|
||||
// links: mzansiProfileProvider.personalLinks,
|
||||
links: getTempLinks(),
|
||||
),
|
||||
const SizedBox(height: 5.0),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
MihButton(
|
||||
onPressed: () {
|
||||
editProfileWindow(width);
|
||||
},
|
||||
buttonColor: MihColors.green(),
|
||||
// width: mzansiProfileProvider.personalLinks.isNotEmpty ? 50 : null,
|
||||
width: getTempLinks().isNotEmpty ? 50 : null,
|
||||
height: 50,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.add,
|
||||
color: MihColors.primary(),
|
||||
),
|
||||
// if (mzansiProfileProvider.personalLinks.isEmpty)
|
||||
if (getTempLinks().isEmpty)
|
||||
Text(
|
||||
"Add Links",
|
||||
style: TextStyle(
|
||||
color: MihColors.primary(),
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20.0),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user