mirror of
https://github.com/jonasbark/swiftcontrol.git
synced 2026-12-06 07:54:00 +01:00
instructions UI change
This commit is contained in:
1 parent
997391f0b1
commit
8544696276
7 files changed
+178
-192
No files matched your search
@@ -99,11 +99,10 @@ class ZwiftClickV2 extends ZwiftRide {
|
||||
|
||||
Button.secondary(
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (_) => MarkdownPage(assetPath: 'TROUBLESHOOTING.md'),
|
||||
),
|
||||
openDrawer(
|
||||
context: context,
|
||||
position: OverlayPosition.bottom,
|
||||
builder: (_) => MarkdownPage(assetPath: 'TROUBLESHOOTING.md'),
|
||||
);
|
||||
},
|
||||
leading: const Icon(Icons.help_outline_outlined),
|
||||
@@ -136,11 +135,10 @@ class ZwiftClickV2 extends ZwiftRide {
|
||||
LinkButton(
|
||||
child: Text(context.i18n.troubleshootingGuide),
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (_) => MarkdownPage(assetPath: 'TROUBLESHOOTING.md'),
|
||||
),
|
||||
openDrawer(
|
||||
context: context,
|
||||
position: OverlayPosition.bottom,
|
||||
builder: (_) => MarkdownPage(assetPath: 'TROUBLESHOOTING.md'),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
+27
-44
@@ -1,10 +1,8 @@
|
||||
import 'package:dartx/dartx.dart';
|
||||
import 'package:flutter/material.dart' show BackButton;
|
||||
import 'package:bike_control/widgets/ui/gradient_text.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_md/flutter_md.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:shadcn_flutter/shadcn_flutter.dart';
|
||||
import 'package:bike_control/widgets/ui/colored_title.dart';
|
||||
import 'package:url_launcher/url_launcher_string.dart';
|
||||
|
||||
class MarkdownPage extends StatefulWidget {
|
||||
@@ -40,51 +38,36 @@ class _ChangelogPageState extends State<MarkdownPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
headers: [
|
||||
AppBar(
|
||||
leading: [
|
||||
BackButton(),
|
||||
],
|
||||
title: Text(
|
||||
widget.assetPath
|
||||
.replaceAll('.md', '')
|
||||
.split('_')
|
||||
.joinToString(separator: ' ', transform: (s) => s.toLowerCase().capitalize()),
|
||||
),
|
||||
),
|
||||
],
|
||||
child: _error != null
|
||||
? Center(child: Text(_error!))
|
||||
: _groups == null
|
||||
? Center(child: CircularProgressIndicator())
|
||||
: SingleChildScrollView(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Accordion(
|
||||
items: _groups!
|
||||
.map(
|
||||
(group) => AccordionItem(
|
||||
trigger: AccordionTrigger(child: ColoredTitle(text: group.title)),
|
||||
content: MarkdownWidget(
|
||||
markdown: group.markdown,
|
||||
theme: MarkdownThemeData(
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14.0,
|
||||
color: Theme.of(context).colorScheme.brightness == Brightness.dark
|
||||
? Colors.white.withAlpha(255 * 70)
|
||||
: Colors.black.withAlpha(87 * 255),
|
||||
),
|
||||
onLinkTap: (title, url) {
|
||||
launchUrlString(url);
|
||||
},
|
||||
return _error != null
|
||||
? Center(child: Text(_error!))
|
||||
: _groups == null
|
||||
? Center(child: CircularProgressIndicator())
|
||||
: SingleChildScrollView(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Accordion(
|
||||
items: _groups!
|
||||
.map(
|
||||
(group) => AccordionItem(
|
||||
trigger: AccordionTrigger(child: GradientText(group.title).bold),
|
||||
content: MarkdownWidget(
|
||||
markdown: group.markdown,
|
||||
theme: MarkdownThemeData(
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14.0,
|
||||
color: Theme.of(context).colorScheme.brightness == Brightness.dark
|
||||
? Colors.white.withAlpha(255 * 70)
|
||||
: Colors.black.withAlpha(87 * 255),
|
||||
),
|
||||
onLinkTap: (title, url) {
|
||||
launchUrlString(url);
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
void _parseMarkdown(String md) {
|
||||
|
||||
+72
-73
@@ -132,10 +132,10 @@ class _NavigationState extends State<Navigation> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
Scaffold(
|
||||
headers: [
|
||||
return Scaffold(
|
||||
headers: [
|
||||
Stack(
|
||||
children: [
|
||||
AppBar(
|
||||
padding:
|
||||
const EdgeInsets.only(top: 12, bottom: 8, left: 12, right: 12) *
|
||||
@@ -154,78 +154,77 @@ class _NavigationState extends State<Navigation> {
|
||||
: null,
|
||||
),
|
||||
),
|
||||
Divider(),
|
||||
],
|
||||
footers: _isMobile
|
||||
? [
|
||||
if (_isMobile) Center(child: HelpButton(isMobile: true)),
|
||||
Divider(),
|
||||
_buildNavigationBar(),
|
||||
]
|
||||
: [],
|
||||
floatingFooter: true,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (!_isMobile) ...[
|
||||
_buildNavigationMenu(),
|
||||
VerticalDivider(),
|
||||
],
|
||||
Expanded(
|
||||
child: AnimatedSwitcher(
|
||||
duration: Duration(milliseconds: 200),
|
||||
child: switch (_selectedPage) {
|
||||
BCPage.devices => Align(
|
||||
alignment: Alignment.topLeft,
|
||||
key: _pageKeys[BCPage.devices],
|
||||
child: DevicePage(
|
||||
isMobile: _isMobile,
|
||||
onUpdate: () {
|
||||
setState(() {
|
||||
_selectedPage = BCPage.trainer;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
BCPage.trainer => Align(
|
||||
alignment: Alignment.topLeft,
|
||||
key: _pageKeys[BCPage.trainer],
|
||||
child: TrainerPage(
|
||||
onUpdate: () {
|
||||
setState(() {});
|
||||
},
|
||||
goToNextPage: () {
|
||||
setState(() {
|
||||
_selectedPage = BCPage.customization;
|
||||
});
|
||||
},
|
||||
isMobile: _isMobile,
|
||||
),
|
||||
),
|
||||
BCPage.customization => Align(
|
||||
alignment: Alignment.topLeft,
|
||||
key: _pageKeys[BCPage.customization],
|
||||
child: CustomizePage(isMobile: _isMobile),
|
||||
),
|
||||
BCPage.logs => Padding(
|
||||
padding: EdgeInsets.only(bottom: _isMobile ? 146 : 16, left: 16, right: 16, top: 16),
|
||||
child: LogViewer(
|
||||
key: _pageKeys[BCPage.logs],
|
||||
),
|
||||
),
|
||||
},
|
||||
),
|
||||
if (!_isMobile)
|
||||
Container(
|
||||
alignment: Alignment.topCenter,
|
||||
child: HelpButton(isMobile: false),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
if (!_isMobile)
|
||||
Container(
|
||||
alignment: Alignment.topCenter,
|
||||
child: HelpButton(isMobile: false),
|
||||
),
|
||||
Divider(),
|
||||
],
|
||||
footers: _isMobile
|
||||
? [
|
||||
if (_isMobile) Center(child: HelpButton(isMobile: true)),
|
||||
Divider(),
|
||||
_buildNavigationBar(),
|
||||
]
|
||||
: [],
|
||||
floatingFooter: true,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (!_isMobile) ...[
|
||||
_buildNavigationMenu(),
|
||||
VerticalDivider(),
|
||||
],
|
||||
Expanded(
|
||||
child: AnimatedSwitcher(
|
||||
duration: Duration(milliseconds: 200),
|
||||
child: switch (_selectedPage) {
|
||||
BCPage.devices => Align(
|
||||
alignment: Alignment.topLeft,
|
||||
key: _pageKeys[BCPage.devices],
|
||||
child: DevicePage(
|
||||
isMobile: _isMobile,
|
||||
onUpdate: () {
|
||||
setState(() {
|
||||
_selectedPage = BCPage.trainer;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
BCPage.trainer => Align(
|
||||
alignment: Alignment.topLeft,
|
||||
key: _pageKeys[BCPage.trainer],
|
||||
child: TrainerPage(
|
||||
onUpdate: () {
|
||||
setState(() {});
|
||||
},
|
||||
goToNextPage: () {
|
||||
setState(() {
|
||||
_selectedPage = BCPage.customization;
|
||||
});
|
||||
},
|
||||
isMobile: _isMobile,
|
||||
),
|
||||
),
|
||||
BCPage.customization => Align(
|
||||
alignment: Alignment.topLeft,
|
||||
key: _pageKeys[BCPage.customization],
|
||||
child: CustomizePage(isMobile: _isMobile),
|
||||
),
|
||||
BCPage.logs => Padding(
|
||||
padding: EdgeInsets.only(bottom: _isMobile ? 146 : 16, left: 16, right: 16, top: 16),
|
||||
child: LogViewer(
|
||||
key: _pageKeys[BCPage.logs],
|
||||
),
|
||||
),
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,11 +48,10 @@ class _MywhooshLinkTileState extends State<MyWhooshLinkTile> {
|
||||
duration: Duration(seconds: 6),
|
||||
closeTitle: 'Open',
|
||||
onClose: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (_) => MarkdownPage(assetPath: 'INSTRUCTIONS_MYWHOOSH_LINK.md'),
|
||||
),
|
||||
openDrawer(
|
||||
context: context,
|
||||
position: OverlayPosition.bottom,
|
||||
builder: (c) => MarkdownPage(assetPath: 'INSTRUCTIONS_MYWHOOSH_LINK.md'),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
+59
-54
@@ -20,67 +20,68 @@ import '../utils/iap/iap_manager.dart';
|
||||
|
||||
List<Widget> buildMenuButtons(BuildContext context, BCPage currentPage, VoidCallback? openLogs) {
|
||||
return [
|
||||
Builder(
|
||||
builder: (context) {
|
||||
return OutlineButton(
|
||||
density: ButtonDensity.icon,
|
||||
onPressed: () {
|
||||
showDropdown(
|
||||
context: context,
|
||||
builder: (c) => DropdownMenu(
|
||||
children: [
|
||||
if ((!Platform.isIOS && !Platform.isMacOS)) ...[
|
||||
MenuLabel(child: Text(context.i18n.showDonation)),
|
||||
MenuButton(
|
||||
child: Text(context.i18n.donateViaCreditCard),
|
||||
onPressed: (c) {
|
||||
final currency = NumberFormat.simpleCurrency(locale: kIsWeb ? 'de_DE' : Platform.localeName);
|
||||
final link = switch (currency.currencyName) {
|
||||
'USD' => 'https://donate.stripe.com/8x24gzc5c4ZE3VJdt36J201',
|
||||
_ => 'https://donate.stripe.com/9B6aEX0muajY8bZ1Kl6J200',
|
||||
};
|
||||
launchUrlString(link);
|
||||
},
|
||||
),
|
||||
if (!kIsWeb && Platform.isAndroid && isFromPlayStore == false)
|
||||
if (IAPManager.instance.isPurchased.value)
|
||||
Builder(
|
||||
builder: (context) {
|
||||
return OutlineButton(
|
||||
density: ButtonDensity.icon,
|
||||
onPressed: () {
|
||||
showDropdown(
|
||||
context: context,
|
||||
builder: (c) => DropdownMenu(
|
||||
children: [
|
||||
if ((!Platform.isIOS && !Platform.isMacOS)) ...[
|
||||
MenuLabel(child: Text(context.i18n.showDonation)),
|
||||
MenuButton(
|
||||
child: Text(context.i18n.donateByBuyingFromPlayStore),
|
||||
child: Text(context.i18n.donateViaCreditCard),
|
||||
onPressed: (c) {
|
||||
launchUrlString('https://play.google.com/store/apps/details?id=de.jonasbark.swiftcontrol');
|
||||
final currency = NumberFormat.simpleCurrency(locale: kIsWeb ? 'de_DE' : Platform.localeName);
|
||||
final link = switch (currency.currencyName) {
|
||||
'USD' => 'https://donate.stripe.com/8x24gzc5c4ZE3VJdt36J201',
|
||||
_ => 'https://donate.stripe.com/9B6aEX0muajY8bZ1Kl6J200',
|
||||
};
|
||||
launchUrlString(link);
|
||||
},
|
||||
),
|
||||
if (!kIsWeb && Platform.isAndroid && isFromPlayStore == false)
|
||||
MenuButton(
|
||||
child: Text(context.i18n.donateByBuyingFromPlayStore),
|
||||
onPressed: (c) {
|
||||
launchUrlString('https://play.google.com/store/apps/details?id=de.jonasbark.swiftcontrol');
|
||||
},
|
||||
),
|
||||
MenuButton(
|
||||
child: Text(context.i18n.donateViaPaypal),
|
||||
onPressed: (c) {
|
||||
launchUrlString('https://paypal.me/boni');
|
||||
},
|
||||
),
|
||||
],
|
||||
MenuButton(
|
||||
child: Text(context.i18n.donateViaPaypal),
|
||||
onPressed: (c) {
|
||||
launchUrlString('https://paypal.me/boni');
|
||||
leading: Icon(Icons.star_rate),
|
||||
child: Text(context.i18n.leaveAReview),
|
||||
onPressed: (c) async {
|
||||
final InAppReview inAppReview = InAppReview.instance;
|
||||
|
||||
if (await inAppReview.isAvailable()) {
|
||||
inAppReview.requestReview();
|
||||
} else {
|
||||
inAppReview.openStoreListing(appStoreId: 'id6753721284', microsoftStoreId: '9NP42GS03Z26');
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
MenuButton(
|
||||
leading: Icon(Icons.star_rate),
|
||||
child: Text(context.i18n.leaveAReview),
|
||||
onPressed: (c) async {
|
||||
final InAppReview inAppReview = InAppReview.instance;
|
||||
|
||||
if (await inAppReview.isAvailable()) {
|
||||
inAppReview.requestReview();
|
||||
} else {
|
||||
inAppReview.openStoreListing(appStoreId: 'id6753721284', microsoftStoreId: '9NP42GS03Z26');
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Icon(
|
||||
Icons.favorite,
|
||||
color: Colors.red,
|
||||
size: 18,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Icon(
|
||||
Icons.favorite,
|
||||
color: Colors.red,
|
||||
size: 18,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
Gap(4),
|
||||
|
||||
BKMenuButton(openLogs: openLogs, currentPage: currentPage),
|
||||
@@ -166,7 +167,11 @@ class BKMenuButton extends StatelessWidget {
|
||||
leading: Icon(Icons.update_outlined),
|
||||
child: Text(context.i18n.changelog),
|
||||
onPressed: (c) {
|
||||
Navigator.push(context, MaterialPageRoute(builder: (c) => MarkdownPage(assetPath: 'CHANGELOG.md')));
|
||||
openDrawer(
|
||||
context: context,
|
||||
position: OverlayPosition.bottom,
|
||||
builder: (c) => MarkdownPage(assetPath: 'CHANGELOG.md'),
|
||||
);
|
||||
},
|
||||
),
|
||||
MenuButton(
|
||||
|
||||
@@ -157,9 +157,10 @@ class _ConnectionMethodState extends State<ConnectionMethod> with WidgetsBinding
|
||||
: ButtonStyle.outline(),
|
||||
leading: Icon(Icons.help_outline),
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (c) => MarkdownPage(assetPath: widget.instructionLink!)),
|
||||
openDrawer(
|
||||
context: context,
|
||||
position: OverlayPosition.bottom,
|
||||
builder: (c) => MarkdownPage(assetPath: widget.instructionLink!),
|
||||
);
|
||||
},
|
||||
child: Text(AppLocalizations.of(context).instructions),
|
||||
|
||||
@@ -138,9 +138,10 @@ class HelpButton extends StatelessWidget {
|
||||
leading: Icon(Icons.help_outline),
|
||||
child: Text(context.i18n.troubleshootingGuide),
|
||||
onPressed: (c) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (c) => MarkdownPage(assetPath: 'TROUBLESHOOTING.md')),
|
||||
openDrawer(
|
||||
context: context,
|
||||
position: OverlayPosition.bottom,
|
||||
builder: (c) => MarkdownPage(assetPath: 'TROUBLESHOOTING.md'),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user