mirror of
https://github.com/foss42/apidash.git
synced 2025-10-16 19:22:23 +08:00
Feat: Brand new introduction page
This commit is contained in:
31
assets/intro.md
Normal file
31
assets/intro.md
Normal file
@ -0,0 +1,31 @@
|
||||
# Welcome to API Dash ⚡️
|
||||
|
||||
#br
|
||||
|
||||
API Dash is a beautiful open-source cross-platform API Client built using Flutter which can help you easily create & customize your API requests, visually inspect responses and generate Dart code on the go.
|
||||
|
||||
Please support this project by giving us a ~`Star on GitHub`~
|
||||
|
||||
#br
|
||||
|
||||
## Getting Started
|
||||
|
||||
#br
|
||||
|
||||
Click on the ~`+ New`~ button to start drafting a new API request.
|
||||
|
||||
#br
|
||||
|
||||
## Support Channel
|
||||
|
||||
#br
|
||||
|
||||
Join our ~`Discord Server`~ and drop a message in the #foss channel.
|
||||
|
||||
#br
|
||||
|
||||
## Report Bug / Request New Feature
|
||||
|
||||
#br
|
||||
|
||||
Just raise an issue in our ~`Github Repo`~
|
@ -1,27 +1,16 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:apidash/providers/providers.dart';
|
||||
import 'package:apidash/widgets/widgets.dart';
|
||||
|
||||
class IntroPage extends ConsumerWidget {
|
||||
class IntroPage extends StatefulWidget {
|
||||
const IntroPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final isDarkMode =
|
||||
ref.watch(settingsProvider.select((value) => value.isDark));
|
||||
State<IntroPage> createState() => _IntroPageState();
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
body: IntroMessage(
|
||||
isDarkMode: isDarkMode,
|
||||
onNew: () {
|
||||
ref.read(collectionStateNotifierProvider.notifier).add();
|
||||
},
|
||||
onModeToggle: () async {
|
||||
var mode = ref.read(settingsProvider).isDark;
|
||||
await ref.read(settingsProvider.notifier).update(isDark: !mode);
|
||||
},
|
||||
),
|
||||
);
|
||||
class _IntroPageState extends State<IntroPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const IntroMessage();
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'package:apidash/consts.dart';
|
||||
import 'package:flutter/services.dart' show rootBundle;
|
||||
import 'markdown.dart';
|
||||
import 'error_message.dart';
|
||||
|
||||
class IntroMessage extends StatefulWidget {
|
||||
const IntroMessage({
|
||||
super.key,
|
||||
required this.isDarkMode,
|
||||
this.onNew,
|
||||
this.onModeToggle,
|
||||
});
|
||||
|
||||
final bool isDarkMode;
|
||||
final void Function()? onNew;
|
||||
final void Function()? onModeToggle;
|
||||
|
||||
@override
|
||||
State<IntroMessage> createState() => _IntroMessageState();
|
||||
}
|
||||
@ -21,224 +15,20 @@ class IntroMessage extends StatefulWidget {
|
||||
class _IntroMessageState extends State<IntroMessage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 40,
|
||||
horizontal: 60,
|
||||
),
|
||||
child: ListView(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"Welcome to API Dash ⚡️",
|
||||
style: Theme.of(context).textTheme.headlineLarge,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
kVSpacer20,
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
kIntro,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
kVSpacer10,
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text.rich(
|
||||
TextSpan(
|
||||
children: [
|
||||
TextSpan(
|
||||
text: "Please support this project by giving us a ",
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: FilledButton.icon(
|
||||
onPressed: () {
|
||||
launchUrl(Uri.parse(kGitUrl));
|
||||
},
|
||||
icon: const Icon(Icons.star),
|
||||
label: const Text(
|
||||
'Star on GitHub',
|
||||
style: kTextStyleButton,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
kVSpacer20,
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"Getting Started",
|
||||
style: Theme.of(context).textTheme.headlineSmall,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
kVSpacer20,
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text.rich(
|
||||
TextSpan(
|
||||
children: [
|
||||
TextSpan(
|
||||
text: "Click on the ",
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: ElevatedButton(
|
||||
onPressed: widget.onNew,
|
||||
child: const Text(
|
||||
kLabelPlusNew,
|
||||
style: kTextStyleButton,
|
||||
),
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: " button to start drafting a new API request.",
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
kVSpacer10,
|
||||
Row(
|
||||
children: [
|
||||
Text.rich(
|
||||
TextSpan(
|
||||
children: [
|
||||
const TextSpan(
|
||||
text: "Choose your theme now: ",
|
||||
),
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: ElevatedButton.icon(
|
||||
onPressed: widget.onModeToggle,
|
||||
icon: widget.isDarkMode
|
||||
? const Icon(Icons.dark_mode)
|
||||
: const Icon(Icons.light_mode),
|
||||
label: Text(
|
||||
widget.isDarkMode ? "Dark" : "Light",
|
||||
style: kTextStyleButton,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
],
|
||||
),
|
||||
kVSpacer20,
|
||||
kVSpacer10,
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"Support Channel",
|
||||
style: Theme.of(context).textTheme.headlineSmall,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
kVSpacer20,
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text.rich(
|
||||
TextSpan(
|
||||
children: [
|
||||
TextSpan(
|
||||
text: "Join our ",
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: FilledButton.icon(
|
||||
onPressed: () {
|
||||
launchUrl(Uri.parse(kDiscordUrl));
|
||||
},
|
||||
icon: const Icon(Icons.discord),
|
||||
label: const Text(
|
||||
'Discord Server',
|
||||
style: kTextStyleButton,
|
||||
),
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: " and drop a message in the #foss channel.",
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
kVSpacer20,
|
||||
kVSpacer10,
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"Report Bug / Request New Feature",
|
||||
style: Theme.of(context).textTheme.headlineSmall,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
kVSpacer20,
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text.rich(
|
||||
TextSpan(
|
||||
children: [
|
||||
TextSpan(
|
||||
text: "Just raise an issue in our ",
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: FilledButton.icon(
|
||||
onPressed: () {
|
||||
launchUrl(Uri.parse(kGitUrl));
|
||||
},
|
||||
icon: const Icon(Icons.code_rounded),
|
||||
label: const Text(
|
||||
'Github Repo',
|
||||
style: kTextStyleButton,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
final Future<String> intro = rootBundle.loadString('assets/intro.md');
|
||||
|
||||
return FutureBuilder(
|
||||
future: intro,
|
||||
builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
|
||||
if ((snapshot.connectionState == ConnectionState.done) &&
|
||||
snapshot.hasData) {
|
||||
return CustomMarkdown(data: snapshot.data!);
|
||||
}
|
||||
if (snapshot.hasError) {
|
||||
return const ErrorMessage(message: "An error occured");
|
||||
}
|
||||
return const CircularProgressIndicator();
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user