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