Skip to content

Commit

Permalink
feat: add about page
Browse files Browse the repository at this point in the history
  • Loading branch information
yousinix committed Apr 9, 2024
1 parent 6b78735 commit 16e8f35
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 0 deletions.
Binary file added assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions assets/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: assets
description: >
Holds the assets for the app. The assets are included in a
separate package, to be able to share it with Widgetbook app.
version: 0.0.0
publish_to: none

environment:
sdk: ">=3.1.0 <4.0.0"

flutter:
assets:
- .
31 changes: 31 additions & 0 deletions lib/about/about_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import 'package:flutter/material.dart';

import '../theme/app_theme.dart';

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

@override
Widget build(BuildContext context) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'logo.png',
package: 'assets',
width: 100,
height: 100,
),
SizedBox(
height: AppTheme.of(context).spacing.medium,
),
Text(
'Created by Widgetbook',
style: AppTheme.of(context).typography.labelMedium14,
),
],
),
);
}
}
5 changes: 5 additions & 0 deletions lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'package:go_router/go_router.dart';

import 'about/about_screen.dart';
import 'basket/basket.dart';
import 'home/home.dart';
import 'l10n/app_localizations.dart';
Expand All @@ -23,6 +24,10 @@ final _router = GoRouter(
},
),
),
GoRoute(
path: '/about',
builder: (context, state) => const AboutScreen(),
),
GoRoute(
path: '/basket',
builder: (context, state) {
Expand Down
7 changes: 7 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
assets:
dependency: "direct main"
description:
path: assets
relative: true
source: path
version: "0.0.0"
async:
dependency: transitive
description:
Expand Down
2 changes: 2 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ environment:
sdk: ">=3.1.0 <4.0.0"

dependencies:
assets:
path: assets
flutter:
sdk: flutter
flutter_localizations:
Expand Down
13 changes: 13 additions & 0 deletions widgetbook/lib/about/about_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import 'package:flutter/widgets.dart';
import 'package:groceries_app/about/about_screen.dart';
import 'package:widgetbook_annotation/widgetbook_annotation.dart';

@UseCase(
name: 'Default',
type: AboutScreen,
)
Widget buildAboutScreenUseCase(BuildContext context) {
// This use-case demonstrates how assets are loaded in
// both app package and widgetbook package simultaneously.
return const AboutScreen();
}
7 changes: 7 additions & 0 deletions widgetbook/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.4.2"
assets:
dependency: "direct main"
description:
path: "../assets"
relative: true
source: path
version: "0.0.0"
async:
dependency: transitive
description:
Expand Down
2 changes: 2 additions & 0 deletions widgetbook/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ environment:
sdk: ">=3.1.0 <4.0.0"

dependencies:
assets:
path: ../assets
flutter:
sdk: flutter
groceries_app:
Expand Down

0 comments on commit 16e8f35

Please sign in to comment.