Skip to content

Commit

Permalink
Unify all pages (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
Feichtmeier authored Feb 28, 2024
1 parent 5a74724 commit fb61fa5
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 142 deletions.
28 changes: 3 additions & 25 deletions lib/contributors_page.dart
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import 'package:flutter/material.dart';
import 'package:ubuntu_service/ubuntu_service.dart';

import 'constants.dart';
import 'contributor_grid.dart';
import 'contributor_service.dart';
import 'foot_note.dart';
import 'header_lead.dart';
import 'header_title.dart';
import 'message_fab.dart';
import 'scaffold_gradient.dart';
import 'splash_screen.dart';
import 'top_menu_entry.dart';
import 'sub_page.dart';

class ContributorsPage extends StatefulWidget {
const ContributorsPage({super.key});
Expand All @@ -36,24 +30,8 @@ class _ContributorsPageState extends State<ContributorsPage> {

@override
Widget build(BuildContext context) {
return Container(
decoration: scaffoldGradient(context),
child: Scaffold(
bottomNavigationBar: const FootNote(),
backgroundColor: Colors.transparent,
appBar: AppBar(
backgroundColor: Colors.transparent,
toolbarHeight: kToolBarHeight,
leadingWidth: kLeadingWidth,
leading: const HeaderLead(
insertBackButton: true,
),
title: const HeaderTitle(),
actions: createTopMenu(context),
),
body: initialized ? const ContributorGrid() : const SplashScreen(),
floatingActionButton: const MessageFab(),
),
return SubPage(
body: initialized ? const ContributorGrid() : const SplashScreen(),
);
}
}
58 changes: 19 additions & 39 deletions lib/getting_started_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,54 +5,34 @@ import 'package:yaru_widgets/constants.dart';
import 'package:yaru_widgets/widgets.dart';

import 'build_context_x.dart';
import 'constants.dart';
import 'foot_note.dart';
import 'header_lead.dart';
import 'header_title.dart';
import 'message_fab.dart';
import 'scaffold_gradient.dart';
import 'top_menu_entry.dart';
import 'sub_page.dart';

class GettingStartedPage extends StatelessWidget {
const GettingStartedPage({super.key});

@override
Widget build(BuildContext context) {
final width = context.mq.size.width;
return Container(
decoration: scaffoldGradient(context),
child: Scaffold(
backgroundColor: Colors.transparent,
appBar: AppBar(
title: const HeaderTitle(),
backgroundColor: Colors.transparent,
toolbarHeight: kToolBarHeight,
leadingWidth: kLeadingWidth,
leading: const HeaderLead(),
actions: createTopMenu(context),
),
body: Center(
child: FutureBuilder(
future: loadMarkdown(),
builder: (context, shot) {
if (!shot.hasData) {
return const Center(
child: YaruCircularProgressIndicator(),
);
}

return Markdown(
padding: EdgeInsets.symmetric(
vertical: kYaruPagePadding,
horizontal: width < 700 ? kYaruPagePadding : width * 0.2,
),
data: shot.data!,
return SubPage(
body: Center(
child: FutureBuilder(
future: loadMarkdown(),
builder: (context, shot) {
if (!shot.hasData) {
return const Center(
child: YaruCircularProgressIndicator(),
);
},
),
}

return Markdown(
padding: EdgeInsets.symmetric(
vertical: kYaruPagePadding,
horizontal: width < 700 ? kYaruPagePadding : width * 0.2,
),
data: shot.data!,
);
},
),
bottomNavigationBar: const FootNote(),
floatingActionButton: const MessageFab(),
),
);
}
Expand Down
91 changes: 36 additions & 55 deletions lib/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,74 +5,55 @@ import 'package:universal_html/html.dart' as html;

import 'build_context_x.dart';
import 'constants.dart';
import 'foot_note.dart';
import 'header_lead.dart';
import 'header_title.dart';
import 'message_fab.dart';
import 'plated_icon.dart';
import 'repositories.dart';
import 'scaffold_gradient.dart';
import 'screen_message.dart';
import 'top_menu_entry.dart';
import 'sub_page.dart';

class HomePage extends StatelessWidget {
const HomePage({super.key});

@override
Widget build(BuildContext context) {
return Container(
decoration: scaffoldGradient(context),
child: Scaffold(
bottomNavigationBar: const FootNote(),
backgroundColor: Colors.transparent,
floatingActionButton: const MessageFab(),
appBar: AppBar(
backgroundColor: Colors.transparent,
toolbarHeight: kToolBarHeight,
leadingWidth: kLeadingWidth,
leading: const HeaderLead(),
title: const HeaderTitle(),
actions: createTopMenu(context),
),
body: SizedBox(
height: context.mq.size.height,
child: ListView(
padding: const EdgeInsets.all(50),
children: [
ScreenMessage(
title: Shimmer.fromColors(
loop: 1,
period: const Duration(seconds: 3),
baseColor: kBaseColor,
highlightColor: kHighlightColor,
child: const Text(kWelcomeTitle),
),
subTitle: Shimmer.fromColors(
baseColor: kBaseColor,
highlightColor: kHighlightColor,
child: InkWell(
borderRadius: BorderRadius.circular(5),
onTap: () => Navigator.of(context).pushNamed('/projects'),
child: const Text(kWelcomeButtonText),
),
return SubPage(
body: SizedBox(
height: context.mq.size.height,
child: ListView(
padding: const EdgeInsets.all(50),
children: [
ScreenMessage(
title: Shimmer.fromColors(
loop: 1,
period: const Duration(seconds: 3),
baseColor: kBaseColor,
highlightColor: kHighlightColor,
child: const Text(kWelcomeTitle),
),
subTitle: Shimmer.fromColors(
baseColor: kBaseColor,
highlightColor: kHighlightColor,
child: InkWell(
borderRadius: BorderRadius.circular(5),
onTap: () => Navigator.of(context).pushNamed('/projects'),
child: const Text(kWelcomeButtonText),
),
label: const Text(kAppTitle),
),
...repositories.map(
(e) => ScreenMessage(
label: Text(e.$1),
title: Text(e.$2),
subTitle: Text(e.$3),
icon: PlatedIcon(
onTap: () =>
html.window.open(p.join(kGitHubPrefix, e.$1, e.$2), ''),
icon: e.$4,
shape: e.$2 == 'settings' ? BoxShape.circle : null,
),
label: const Text(kAppTitle),
),
...repositories.map(
(e) => ScreenMessage(
label: Text(e.$1),
title: Text(e.$2),
subTitle: Text(e.$3),
icon: PlatedIcon(
onTap: () =>
html.window.open(p.join(kGitHubPrefix, e.$1, e.$2), ''),
icon: e.$4,
shape: e.$2 == 'settings' ? BoxShape.circle : null,
),
),
],
),
),
],
),
),
);
Expand Down
26 changes: 3 additions & 23 deletions lib/projects_page.dart
Original file line number Diff line number Diff line change
@@ -1,35 +1,15 @@
import 'package:flutter/material.dart';

import 'constants.dart';
import 'foot_note.dart';
import 'header_lead.dart';
import 'header_title.dart';
import 'message_fab.dart';
import 'projects_list.dart';
import 'scaffold_gradient.dart';
import 'top_menu_entry.dart';
import 'sub_page.dart';

class ProjectsPage extends StatelessWidget {
const ProjectsPage({super.key});

@override
Widget build(BuildContext context) {
return Container(
decoration: scaffoldGradient(context),
child: Scaffold(
bottomNavigationBar: const FootNote(),
backgroundColor: Colors.transparent,
floatingActionButton: const MessageFab(),
appBar: AppBar(
backgroundColor: Colors.transparent,
toolbarHeight: kToolBarHeight,
leadingWidth: kLeadingWidth,
leading: const HeaderLead(),
title: const HeaderTitle(),
actions: createTopMenu(context),
),
body: const ProjectsList(),
),
return const SubPage(
body: ProjectsList(),
);
}
}
38 changes: 38 additions & 0 deletions lib/sub_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import 'package:flutter/material.dart';

import 'constants.dart';
import 'foot_note.dart';
import 'header_lead.dart';
import 'header_title.dart';
import 'message_fab.dart';
import 'scaffold_gradient.dart';
import 'top_menu_entry.dart';

class SubPage extends StatelessWidget {
const SubPage({super.key, required this.body});

final Widget body;

@override
Widget build(BuildContext context) {
return Container(
decoration: scaffoldGradient(context),
child: Scaffold(
bottomNavigationBar: const FootNote(),
backgroundColor: Colors.transparent,
appBar: AppBar(
backgroundColor: Colors.transparent,
toolbarHeight: kToolBarHeight,
leadingWidth: kLeadingWidth,
leading: const HeaderLead(
insertBackButton: true,
),
title: const HeaderTitle(),
actions: createTopMenu(context),
),
body: body,
floatingActionButton: const MessageFab(),
),
);
}
}

0 comments on commit fb61fa5

Please sign in to comment.