support view buttons

This commit is contained in:
julian 2022-11-15 16:21:52 -06:00
parent 19d070c618
commit 15c51e3269

View file

@ -17,14 +17,13 @@ class SupportView extends StatelessWidget {
}) : super(key: key); }) : super(key: key);
static const String routeName = "/support"; static const String routeName = "/support";
final double iconSize = 28;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final isDesktop = Util.isDesktop;
debugPrint("BUILD: $runtimeType"); debugPrint("BUILD: $runtimeType");
final isDesktop = Util.isDesktop;
return ConditionalParent( return ConditionalParent(
condition: !isDesktop, condition: !isDesktop,
builder: (child) { builder: (child) {
@ -64,321 +63,168 @@ class SupportView extends StatelessWidget {
: const SizedBox( : const SizedBox(
height: 12, height: 12,
), ),
RoundedWhiteContainer( AboutItem(
padding: const EdgeInsets.all(0), linkUrl: "https://t.me/stackwallet",
child: RawMaterialButton( label: "Telegram",
// splashColor: Theme.of(context).extension<StackColors>()!.highlight, buttonText: "@stackwallet",
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, iconAsset: Assets.socials.telegram,
shape: RoundedRectangleBorder( isDesktop: isDesktop,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
),
onPressed: () {
if (!isDesktop) {
launchUrl(
Uri.parse("https://t.me/stackwallet"),
mode: LaunchMode.externalApplication,
);
}
},
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 20,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
SvgPicture.asset(
Assets.socials.telegram,
width: iconSize,
height: iconSize,
color: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
),
const SizedBox(
width: 12,
),
Text(
"Telegram",
style: STextStyles.titleBold12(context),
textAlign: TextAlign.left,
),
],
),
BlueTextButton(
text: isDesktop ? "@stackwallet" : "",
onTap: () {
launchUrl(
Uri.parse("https://t.me/stackwallet"),
mode: LaunchMode.externalApplication,
);
},
),
],
),
),
),
), ),
const SizedBox( const SizedBox(
height: 8, height: 8,
), ),
RoundedWhiteContainer( AboutItem(
padding: const EdgeInsets.all(0), linkUrl: "https://discord.gg/RZMG3yUm",
child: RawMaterialButton( label: "Discord",
// splashColor: Theme.of(context).extension<StackColors>()!.highlight, buttonText: "Stack Wallet",
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, iconAsset: Assets.socials.discord,
shape: RoundedRectangleBorder( isDesktop: isDesktop,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
),
onPressed: () {
if (!isDesktop) {
launchUrl(
Uri.parse("https://discord.gg/RZMG3yUm"),
mode: LaunchMode.externalApplication,
);
}
},
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 20,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
SvgPicture.asset(
Assets.socials.discord,
width: iconSize,
height: iconSize,
color: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
),
const SizedBox(
width: 12,
),
Text(
"Discord",
style: STextStyles.titleBold12(context),
textAlign: TextAlign.left,
),
],
),
BlueTextButton(
text: isDesktop ? "Stack Wallet" : "",
onTap: () {
launchUrl(
Uri.parse(
"https://discord.gg/RZMG3yUm"), //expired link?
mode: LaunchMode.externalApplication,
);
},
),
],
),
),
),
), ),
const SizedBox( const SizedBox(
height: 8, height: 8,
), ),
RoundedWhiteContainer( AboutItem(
padding: const EdgeInsets.all(0), linkUrl: "https://www.reddit.com/r/stackwallet/",
child: RawMaterialButton( label: "Reddit",
// splashColor: Theme.of(context).extension<StackColors>()!.highlight, buttonText: "r/stackwallet",
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, iconAsset: Assets.socials.reddit,
shape: RoundedRectangleBorder( isDesktop: isDesktop,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
),
onPressed: () {
if (!isDesktop) {
launchUrl(
Uri.parse("https://www.reddit.com/r/stackwallet/"),
mode: LaunchMode.externalApplication,
);
}
},
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 20,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
SvgPicture.asset(
Assets.socials.reddit,
width: iconSize,
height: iconSize,
color: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
),
const SizedBox(
width: 12,
),
Text(
"Reddit",
style: STextStyles.titleBold12(context),
textAlign: TextAlign.left,
),
],
),
BlueTextButton(
text: isDesktop ? "r/stackwallet" : "",
onTap: () {
launchUrl(
Uri.parse("https://www.reddit.com/r/stackwallet/"),
mode: LaunchMode.externalApplication,
);
},
),
],
),
),
),
), ),
const SizedBox( const SizedBox(
height: 8, height: 8,
), ),
RoundedWhiteContainer( AboutItem(
padding: const EdgeInsets.all(0), linkUrl: "https://twitter.com/stack_wallet",
child: RawMaterialButton( label: "Twitter",
// splashColor: Theme.of(context).extension<StackColors>()!.highlight, buttonText: "@stack_wallet",
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, iconAsset: Assets.socials.twitter,
shape: RoundedRectangleBorder( isDesktop: isDesktop,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
),
onPressed: () {
if (!isDesktop) {
launchUrl(
Uri.parse("https://twitter.com/stack_wallet"),
mode: LaunchMode.externalApplication,
);
}
},
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 20,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
SvgPicture.asset(
Assets.socials.twitter,
width: iconSize,
height: iconSize,
color: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
),
const SizedBox(
width: 12,
),
Text(
"Twitter",
style: STextStyles.titleBold12(context),
textAlign: TextAlign.left,
),
],
),
BlueTextButton(
text: isDesktop ? "@stack_wallet" : "",
onTap: () {
launchUrl(
Uri.parse("https://twitter.com/stack_wallet"),
mode: LaunchMode.externalApplication,
);
},
),
],
),
),
),
), ),
const SizedBox( const SizedBox(
height: 8, height: 8,
), ),
RoundedWhiteContainer( AboutItem(
padding: const EdgeInsets.all(0), linkUrl: "mailto://support@stackwallet.com",
child: RawMaterialButton( label: "Email",
// splashColor: Theme.of(context).extension<StackColors>()!.highlight, buttonText: "support@stackwallet.com",
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, iconAsset: Assets.svg.envelope,
shape: RoundedRectangleBorder( isDesktop: isDesktop,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
),
onPressed: () {
if (!isDesktop) {
launchUrl(
Uri.parse("mailto://support@stackwallet.com"),
mode: LaunchMode.externalApplication,
);
}
},
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 20,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
SvgPicture.asset(
Assets.svg.envelope,
width: iconSize,
height: iconSize,
color: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
),
const SizedBox(
width: 12,
),
Text(
"Email",
style: STextStyles.titleBold12(context),
textAlign: TextAlign.left,
),
],
),
BlueTextButton(
text: isDesktop ? "support@stackwallet.com" : "",
onTap: () {
launchUrl(
Uri.parse("mailto://support@stackwallet.com"),
mode: LaunchMode.externalApplication,
);
},
),
],
),
),
),
), ),
], ],
), ),
); );
} }
} }
class AboutItem extends StatelessWidget {
const AboutItem({
Key? key,
required this.linkUrl,
required this.label,
required this.buttonText,
required this.iconAsset,
required this.isDesktop,
}) : super(key: key);
final String linkUrl;
final String label;
final String buttonText;
final String iconAsset;
final bool isDesktop;
@override
Widget build(BuildContext context) {
final double iconSize = isDesktop ? 20 : 28;
return RoundedWhiteContainer(
padding: const EdgeInsets.all(0),
child: ConditionalParent(
condition: !isDesktop,
builder: (child) => RawMaterialButton(
// splashColor: Theme.of(context).extension<StackColors>()!.highlight,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
),
onPressed: () {
launchUrl(
Uri.parse(linkUrl),
mode: LaunchMode.externalApplication,
);
},
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 20,
),
child: child,
),
),
child: Padding(
padding: isDesktop
? const EdgeInsets.symmetric(
horizontal: 20,
vertical: 15,
)
: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 20,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
ConditionalParent(
condition: isDesktop,
builder: (child) => Container(
width: 40,
height: 40,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10000),
color: Theme.of(context)
.extension<StackColors>()!
.buttonBackSecondary,
),
child: Center(
child: child,
),
),
child: SvgPicture.asset(
iconAsset,
width: iconSize,
height: iconSize,
color: Theme.of(context)
.extension<StackColors>()!
.bottomNavIconIcon,
),
),
const SizedBox(
width: 12,
),
Text(
label,
style: STextStyles.titleBold12(context),
textAlign: TextAlign.left,
),
],
),
if (isDesktop)
BlueTextButton(
text: buttonText,
onTap: () {
launchUrl(
Uri.parse(linkUrl),
mode: LaunchMode.externalApplication,
);
},
),
],
),
),
),
);
}
}