Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Coffee Maker Demo App example with navigator 2.0 (Flutter Full Stack Conference) #209

Merged
merged 5 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed coffee_maker/lib/assets/fonts/Inter-Bold.ttf
Binary file not shown.
Binary file removed coffee_maker/lib/assets/fonts/Inter-ExtraBold.ttf
Binary file not shown.
Binary file removed coffee_maker/lib/assets/fonts/Inter-Regular.ttf
Binary file not shown.
Binary file removed coffee_maker/lib/assets/fonts/Inter-SemiBold.ttf
Binary file not shown.
15 changes: 0 additions & 15 deletions coffee_maker/lib/constants/demo_app_colors.dart

This file was deleted.

12 changes: 7 additions & 5 deletions coffee_maker/lib/home/offline/store_offline_content.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:coffee_maker/constants/demo_app_colors.dart';
import 'package:coffee_maker/home/widgets/top_bar.dart';
import 'package:demo_ui_components/demo_ui_components.dart';
import 'package:flutter/material.dart';
import 'package:wolt_responsive_layout_grid/wolt_responsive_layout_grid.dart';

Expand Down Expand Up @@ -46,7 +46,7 @@ class _StoreOfflineContentState extends State<StoreOfflineContent> {
),
Expanded(
child: ColoredBox(
color: DemoAppColors.red,
color: WoltColors.red,
child: WoltScreenWidthAdaptiveWidget(
smallScreenWidthChild: SizedBox.expand(
child: Padding(
Expand Down Expand Up @@ -87,16 +87,18 @@ class _OfflineContent extends StatelessWidget {
Text(
'You are offline',
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.displaySmall!.copyWith(
fontWeight: FontWeight.bold, color: DemoAppColors.white),
style: Theme.of(context)
.textTheme
.displaySmall!
.copyWith(fontWeight: FontWeight.bold, color: WoltColors.white),
),
const SizedBox(height: 12),
Text(
'Go online to receive new orders.',
style: Theme.of(context)
.textTheme
.bodyMedium!
.copyWith(color: DemoAppColors.white),
.copyWith(color: WoltColors.white),
textAlign: TextAlign.center,
),
const SizedBox(height: 32),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:coffee_maker/constants/demo_app_colors.dart';
import 'package:coffee_maker/entities/coffee_maker_step.dart';
import 'package:coffee_maker/home/online/widgets/coffee_order_list_widget.dart';
import 'package:demo_ui_components/demo_ui_components.dart';
import 'package:flutter/material.dart';

/// A section that displays a list of coffee orders on a large screen.
Expand Down Expand Up @@ -33,14 +33,14 @@ class LargeScreenCoffeeOrderListSection extends StatelessWidget {
height: double.infinity,
padding: const EdgeInsets.symmetric(horizontal: 8),
color: _coffeeMakerStep == CoffeeMakerStep.ready
? DemoAppColors.white
? WoltColors.white
: null,
decoration: _coffeeMakerStep == CoffeeMakerStep.ready
? null
: const ShapeDecoration(
color: DemoAppColors.black4,
color: WoltColors.black8,
shape: RoundedRectangleBorder(
side: BorderSide(color: DemoAppColors.white, width: 2),
side: BorderSide(color: WoltColors.white, width: 2),
borderRadius: BorderRadius.only(
topRight: Radius.circular(16),
topLeft: Radius.circular(16),
Expand Down Expand Up @@ -74,9 +74,9 @@ class _LargeScreenCoffeeOrderListHeader extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6),
margin: const EdgeInsets.only(top: 16, bottom: 8),
decoration: const ShapeDecoration(
shape: StadiumBorder(
side: BorderSide(color: DemoAppColors.gray, width: 2)),
color: DemoAppColors.white,
shape:
StadiumBorder(side: BorderSide(color: WoltColors.gray, width: 2)),
color: WoltColors.white,
),
child: Text(
'${_coffeeMakerStep.stepName} ($_count)',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:coffee_maker/constants/demo_app_colors.dart';
import 'package:coffee_maker/entities/coffee_maker_step.dart';
import 'package:coffee_maker/entities/grouped_coffee_orders.dart';
import 'package:coffee_maker/home/widgets/coffee_maker_custom_divider.dart';
import 'package:demo_ui_components/demo_ui_components.dart';
import 'package:flutter/material.dart';

typedef OnCoffeeMakerStepSelected = void Function(CoffeeMakerStep selectedStep);
Expand Down Expand Up @@ -130,11 +130,11 @@ class _DestinationIcon extends StatelessWidget {
@override
Widget build(BuildContext context) {
final icon = Icon(iconData,
color: isSelected ? DemoAppColors.blue : DemoAppColors.black64);
color: isSelected ? WoltColors.blue : WoltColors.black64);
return count == 0
? icon
: Badge(
backgroundColor: DemoAppColors.red,
backgroundColor: WoltColors.red,
label: Text(count.toString()),
child: icon,
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import 'package:coffee_maker/constants/demo_app_colors.dart';
import 'package:coffee_maker/entities/coffee_maker_step.dart';
import 'package:coffee_maker/entities/grouped_coffee_orders.dart';
import 'package:coffee_maker/home/online/small_screen/small_screen_bottom_navigation_bar.dart';
import 'package:coffee_maker/home/online/widgets/coffee_order_list_widget.dart';
import 'package:coffee_maker/home/widgets/top_bar.dart';
import 'package:demo_ui_components/demo_ui_components.dart';
import 'package:flutter/material.dart';

/// A widget that represents the online content for small screens.
Expand Down Expand Up @@ -51,7 +51,7 @@ class _SmallScreenOnlineContentState extends State<SmallScreenOnlineContent> {
width: double.infinity,
height: double.infinity,
padding: const EdgeInsets.symmetric(horizontal: 16),
color: DemoAppColors.black4,
color: WoltColors.black8,
child: widget._coffeeMakerStepListWidgets[
_selectedStepForBottomNavigationBar]!,
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:coffee_maker/constants/demo_app_colors.dart';
import 'package:coffee_maker/entities/coffee_order.dart';
import 'package:demo_ui_components/demo_ui_components.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

Expand Down Expand Up @@ -44,7 +44,7 @@ class CoffeeOrderListItemTile extends StatelessWidget {
fit: BoxFit.cover,
width: double.infinity,
),
Container(color: DemoAppColors.black.withOpacity(0.3)),
Container(color: WoltColors.black.withOpacity(0.3)),
Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
Expand Down Expand Up @@ -100,16 +100,18 @@ class _CoffeeOrderListItemDetails extends StatelessWidget {
onPressed: _onTap,
child: Text(
_coffeeOrder.id,
style: Theme.of(context).textTheme.headlineSmall!.copyWith(
fontWeight: FontWeight.bold, color: DemoAppColors.black),
style: Theme.of(context)
.textTheme
.headlineSmall!
.copyWith(fontWeight: FontWeight.bold, color: WoltColors.black),
),
),
const SizedBox(width: 8),
Expanded(
child: Text(
_coffeeOrder.orderName,
style: Theme.of(context).textTheme.titleMedium!.copyWith(
color: DemoAppColors.white,
color: WoltColors.white,
fontWeight: FontWeight.bold,
),
maxLines: 1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:coffee_maker/constants/demo_app_colors.dart';
import 'package:demo_ui_components/demo_ui_components.dart';
import 'package:flutter/material.dart';

class CoffeeMakerCustomDivider extends StatelessWidget {
Expand All @@ -7,7 +7,7 @@ class CoffeeMakerCustomDivider extends StatelessWidget {
@override
Widget build(BuildContext context) {
return const ColoredBox(
color: DemoAppColors.gray,
color: WoltColors.gray,
child: SizedBox(height: 1, width: double.infinity),
);
}
Expand Down
9 changes: 0 additions & 9 deletions coffee_maker/lib/home/widgets/grid_layout_button.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:coffee_maker/constants/demo_app_colors.dart';
import 'package:flutter/material.dart';

/// The `GridLayoutButton` widget displays a button indicating the visibility of the grid layout.
Expand All @@ -17,14 +16,6 @@ class GridLayoutButton extends StatelessWidget {
valueListenable: _isGridOverlayVisible,
builder: (_, isVisible, __) {
return OutlinedButton(
style: Theme.of(context).outlinedButtonTheme.style!.copyWith(
side: const MaterialStatePropertyAll(
BorderSide(
width: 2,
color: DemoAppColors.gray,
),
),
),
onPressed: () {
_isGridOverlayVisible.value = !_isGridOverlayVisible.value;
},
Expand Down
8 changes: 4 additions & 4 deletions coffee_maker/lib/home/widgets/store_online_status_button.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:coffee_maker/constants/demo_app_colors.dart';
import 'package:demo_ui_components/demo_ui_components.dart';
import 'package:flutter/material.dart';
import 'package:wolt_responsive_layout_grid/wolt_responsive_layout_grid.dart';

Expand All @@ -20,7 +20,7 @@ class StoreOnlineStatusButton extends StatelessWidget {
return OutlinedButton(
style: Theme.of(context).outlinedButtonTheme.style!.copyWith(
side: const MaterialStatePropertyAll(
BorderSide(width: 2, color: DemoAppColors.gray)),
BorderSide(width: 2, color: WoltColors.gray)),
),
onPressed: () {
_isStoreOnlineNotifier.value = !_isStoreOnlineNotifier.value;
Expand All @@ -32,15 +32,15 @@ class StoreOnlineStatusButton extends StatelessWidget {
child: DecoratedBox(
decoration: ShapeDecoration(
shape: const CircleBorder(),
color: isOnline ? DemoAppColors.green : DemoAppColors.red,
color: isOnline ? WoltColors.green : WoltColors.red,
),
)),
const SizedBox(width: 8),
WoltScreenWidthAdaptiveWidget(
smallScreenWidthChild: const Icon(
Icons.store,
size: 16,
color: DemoAppColors.black,
color: WoltColors.black,
),
largeScreenWidthChild: Text(isOnline ? 'Online' : 'Offline'),
),
Expand Down
92 changes: 6 additions & 86 deletions coffee_maker/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import 'dart:io';

import 'package:coffee_maker/entities/grouped_coffee_orders.dart';
import 'package:coffee_maker/entities/mock_coffee_orders.dart';
import 'package:coffee_maker/home/home_screen.dart';
import 'package:demo_ui_components/demo_ui_components.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

import 'constants/demo_app_colors.dart';

void main() => runApp(const DemoApp());

class DemoApp extends StatefulWidget {
Expand All @@ -27,8 +22,8 @@ class _DemoAppState extends State<DemoApp> {
SystemChrome.setSystemUIOverlayStyle(
const SystemUiOverlayStyle(
systemNavigationBarIconBrightness: Brightness.dark,
systemNavigationBarDividerColor: DemoAppColors.white,
systemNavigationBarColor: DemoAppColors.white,
systemNavigationBarDividerColor: WoltColors.white,
systemNavigationBarColor: WoltColors.white,
),
);
}
Expand All @@ -44,86 +39,11 @@ class _DemoAppState extends State<DemoApp> {
scrollBehavior: const CustomScrollBehavior(),
debugShowCheckedModeBanner: false,
home: Theme(
data: Theme.of(context).copyWith(
primaryColor: DemoAppColors.blue,
useMaterial3: true,
inputDecorationTheme: const InputDecorationTheme(
suffixStyle: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w400,
color: DemoAppColors.black64,
),
contentPadding: EdgeInsetsDirectional.fromSTEB(16, 12, 16, 8),
border: UnderlineInputBorder(borderSide: BorderSide.none),
constraints: BoxConstraints(minHeight: 64),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: WoltColors.blue),
borderRadius: BorderRadius.all(Radius.circular(8)),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: WoltColors.black16),
borderRadius: BorderRadius.all(Radius.circular(8)),
),
focusColor: WoltColors.blue,
),
textTheme: TextTheme(
headlineMedium: TextStyle(
fontSize: 28,
color: DemoAppColors.black,
fontWeight: FontWeight.w800,
letterSpacing: kIsWeb || Platform.isAndroid ? 0.2 : 0.12,
),
),
typography: Typography.material2021(platform: defaultTargetPlatform),
scaffoldBackgroundColor: DemoAppColors.white,
indicatorColor: Colors.transparent,
cardColor: DemoAppColors.white,
cardTheme: CardTheme(
elevation: 2,
color: DemoAppColors.white,
surfaceTintColor: DemoAppColors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
),
outlinedButtonTheme: OutlinedButtonThemeData(
style: OutlinedButton.styleFrom(
textStyle: Theme.of(context)
.textTheme
.bodyMedium!
.copyWith(fontWeight: FontWeight.bold),
foregroundColor: DemoAppColors.black,
backgroundColor: DemoAppColors.white,
surfaceTintColor: DemoAppColors.white,
fixedSize: const Size.fromHeight(36),
padding: const EdgeInsets.all(12),
visualDensity: VisualDensity.compact,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
side: BorderSide.none,
),
),
navigationBarTheme: NavigationBarThemeData(
height: 56,
surfaceTintColor: Colors.transparent,
backgroundColor: DemoAppColors.white,
indicatorColor: Colors.transparent,
labelBehavior: NavigationDestinationLabelBehavior.alwaysShow,
labelTextStyle: MaterialStateProperty.resolveWith<TextStyle>(
(state) {
return TextStyle(
fontSize: 10,
color: state.contains(MaterialState.selected)
? DemoAppColors.blue
: DemoAppColors.black64,
);
},
),
),
),
data: AppThemeData.themeData(context),
child: HomeScreen(
groupedCoffeeOrders:
GroupedCoffeeOrders.fromCoffeeOrders(mockCoffeeOrders),
groupedCoffeeOrders: GroupedCoffeeOrders.fromCoffeeOrders(
mockCoffeeOrders,
),
isStoreOnline: true,
isGridOverlayVisible: false,
),
Expand Down
2 changes: 2 additions & 0 deletions coffee_maker/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import FlutterMacOS
import Foundation

import path_provider_foundation

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
}
2 changes: 1 addition & 1 deletion coffee_maker/macos/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0920;
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
33CC10EC2044A3C60003C045 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
1 change: 0 additions & 1 deletion coffee_maker/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ flutter:

assets:
- lib/assets/images/
- lib/assets/fonts/
Loading
Loading