change design on profile links and add git option
This commit is contained in:
@@ -3,7 +3,7 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/profile_link.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_tile.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_button.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
@@ -26,72 +26,87 @@ class MihProfileLinks extends StatefulWidget {
|
||||
class _MihProfileLinksState extends State<MihProfileLinks> {
|
||||
Widget displayLinkButton(ProfileLink link) {
|
||||
IconData iconData;
|
||||
Color iconColor;
|
||||
Color btnColor;
|
||||
Color iconColor = Colors.white;
|
||||
switch (link.destination.toLowerCase()) {
|
||||
case "youtube":
|
||||
iconData = FontAwesomeIcons.youtube;
|
||||
iconColor = const Color(0xFFFF0000);
|
||||
btnColor = const Color(0xFFFF0000);
|
||||
break;
|
||||
case "tiktok":
|
||||
iconData = FontAwesomeIcons.tiktok;
|
||||
iconColor = const Color(0xFF000000);
|
||||
btnColor = const Color(0xFF000000);
|
||||
break;
|
||||
case "twitch":
|
||||
iconData = FontAwesomeIcons.twitch;
|
||||
iconColor = const Color(0xFF6441a5);
|
||||
btnColor = const Color(0xFF6441a5);
|
||||
break;
|
||||
case "threads":
|
||||
iconData = FontAwesomeIcons.threads;
|
||||
iconColor = const Color(0xFF000000);
|
||||
btnColor = const Color(0xFF000000);
|
||||
break;
|
||||
case "whatsapp":
|
||||
iconData = FontAwesomeIcons.whatsapp;
|
||||
iconColor = const Color(0xFF25D366);
|
||||
btnColor = const Color(0xFF25D366);
|
||||
break;
|
||||
case "instagram":
|
||||
iconData = FontAwesomeIcons.instagram;
|
||||
iconColor = const Color(0xFFF56040);
|
||||
btnColor = const Color(0xFFF56040);
|
||||
break;
|
||||
case "x":
|
||||
iconData = FontAwesomeIcons.xTwitter;
|
||||
iconColor = const Color(0xFF000000);
|
||||
btnColor = const Color(0xFF000000);
|
||||
break;
|
||||
case "linkedin":
|
||||
iconData = FontAwesomeIcons.linkedin;
|
||||
iconColor = const Color(0xFF0a66c2);
|
||||
btnColor = const Color(0xFF0a66c2);
|
||||
break;
|
||||
case "facebook":
|
||||
iconData = FontAwesomeIcons.facebook;
|
||||
iconColor = const Color(0xFF4267B2);
|
||||
btnColor = const Color(0xFF4267B2);
|
||||
break;
|
||||
case "reddit":
|
||||
iconData = FontAwesomeIcons.reddit;
|
||||
iconColor = const Color(0xFFFF4500);
|
||||
btnColor = const Color(0xFFFF4500);
|
||||
break;
|
||||
case "discord":
|
||||
iconData = FontAwesomeIcons.discord;
|
||||
iconColor = const Color(0xFF5865F2);
|
||||
btnColor = const Color(0xFF5865F2);
|
||||
break;
|
||||
case "git":
|
||||
iconData = FontAwesomeIcons.git;
|
||||
btnColor = const Color(0xFF73A952);
|
||||
break;
|
||||
default:
|
||||
iconData = FontAwesomeIcons.link;
|
||||
iconColor = MihColors.getPrimaryColor(
|
||||
btnColor = MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark");
|
||||
}
|
||||
|
||||
return MihPackageTile(
|
||||
onTap: () {
|
||||
return MihButton(
|
||||
onPressed: () {
|
||||
launchSocialUrl(Uri.parse(link.web_link));
|
||||
},
|
||||
appName: link.destination,
|
||||
appIcon: Icon(
|
||||
buttonColor: btnColor,
|
||||
child: FaIcon(
|
||||
iconData,
|
||||
color: iconColor,
|
||||
size: 33,
|
||||
),
|
||||
iconSize: 200,
|
||||
textColor: Colors.black,
|
||||
// MihColors.getPrimaryColor(
|
||||
// MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
);
|
||||
// return MihPackageTile(
|
||||
// onTap: () {
|
||||
// launchSocialUrl(Uri.parse(link.web_link));
|
||||
// },
|
||||
// appName: link.destination,
|
||||
// appIcon: Icon(
|
||||
// iconData,
|
||||
// color: btnColor,
|
||||
// ),
|
||||
// iconSize: 200,
|
||||
// textColor: Colors.black,
|
||||
// // MihColors.getPrimaryColor(
|
||||
// // MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
// );
|
||||
}
|
||||
|
||||
Future<void> launchSocialUrl(Uri linkUrl) async {
|
||||
@@ -112,52 +127,35 @@ class _MihProfileLinksState extends State<MihProfileLinks> {
|
||||
? EdgeInsets.symmetric(horizontal: width * 0.2)
|
||||
: EdgeInsets.symmetric(horizontal: width * 0.075)
|
||||
: EdgeInsetsGeometry.all(0),
|
||||
child: Material(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark")
|
||||
.withValues(alpha: 0.6),
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
elevation: 10,
|
||||
shadowColor: Colors.black,
|
||||
child: Container(
|
||||
width: 500,
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: MihColors.getSecondaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: widget.links.isEmpty
|
||||
? SizedBox(
|
||||
height: 35,
|
||||
child: Text(
|
||||
"No Profile Links",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
),
|
||||
),
|
||||
)
|
||||
: Wrap(
|
||||
alignment: WrapAlignment.center,
|
||||
runSpacing: 15,
|
||||
spacing: 15,
|
||||
children: widget.links.map(
|
||||
(link) {
|
||||
return SizedBox(
|
||||
width: widget.buttonSize ?? 80,
|
||||
height: widget.buttonSize ?? 80,
|
||||
child: displayLinkButton(link),
|
||||
);
|
||||
},
|
||||
).toList(),
|
||||
child: widget.links.isEmpty
|
||||
? SizedBox(
|
||||
height: 35,
|
||||
child: Text(
|
||||
"No Profile Links",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MihColors.getPrimaryColor(
|
||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||
"Dark"),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: Wrap(
|
||||
alignment: WrapAlignment.center,
|
||||
runSpacing: 15,
|
||||
spacing: 15,
|
||||
children: widget.links.map(
|
||||
(link) {
|
||||
return SizedBox(
|
||||
width: widget.buttonSize ?? 80,
|
||||
height: widget.buttonSize ?? 80,
|
||||
child: displayLinkButton(link),
|
||||
);
|
||||
},
|
||||
).toList(),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -850,6 +850,14 @@ class _MihInfoState extends State<MihInfo> {
|
||||
destination: "Reddit",
|
||||
web_link: "https://www.reddit.com/r/Mzani_Innovation_Hub/",
|
||||
),
|
||||
ProfileLink(
|
||||
idprofile_links: 1,
|
||||
app_id: "1234",
|
||||
business_id: "",
|
||||
destination: "Git",
|
||||
web_link:
|
||||
"https://git.mzansi-innovation-hub.co.za/yaso_meth/mih-project",
|
||||
),
|
||||
];
|
||||
return Column(
|
||||
children: [
|
||||
|
||||
Reference in New Issue
Block a user