-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1 parent
839b68b
commit 9e19286
Showing
24 changed files
with
483 additions
and
360 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,6 @@ environment: | |
dependencies: | ||
flutter: | ||
sdk: flutter | ||
|
||
google_fonts: ^6.2.0 | ||
superdeck: | ||
path: ../ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
packages/superdeck/lib/components/molecules/navigation_rail.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_hooks/flutter_hooks.dart'; | ||
import 'package:mix/mix.dart'; | ||
|
||
import '../remix/button.dart'; | ||
|
||
class CustomNavigationRail extends HookWidget { | ||
final int selectedIndex; | ||
final ValueChanged<int>? onDestinationSelected; | ||
final List<CustomNavigationRailDestination> destinations; | ||
final bool displayLabel; | ||
final double? leading; | ||
final double? trailing; | ||
|
||
CustomNavigationRail({ | ||
required this.selectedIndex, | ||
this.onDestinationSelected, | ||
required this.destinations, | ||
this.displayLabel = false, | ||
this.leading, | ||
this.trailing, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final _buildDestination = useCallback((int index) { | ||
final destination = destinations[index]; | ||
final isSelected = selectedIndex == index; | ||
|
||
return Padding( | ||
padding: const EdgeInsets.symmetric(vertical: 4), | ||
child: SDIconButton( | ||
icon: destination.icon, | ||
onPressed: () => onDestinationSelected?.call(index), | ||
selected: isSelected, | ||
), | ||
); | ||
}, [selectedIndex, destinations]); | ||
|
||
return VBox( | ||
style: _containerStyle, | ||
children: [ | ||
if (leading != null) SizedBox(height: leading), | ||
for (int i = 0; i < destinations.length; i++) _buildDestination(i), | ||
if (trailing != null) SizedBox(height: trailing), | ||
], | ||
); | ||
} | ||
} | ||
|
||
get _containerStyle => Style( | ||
$box.color.black(), | ||
$box.padding(16), | ||
$box.border.right( | ||
color: Colors.white10, | ||
width: 1, | ||
), | ||
); | ||
|
||
class CustomNavigationRailDestination { | ||
final IconData icon; | ||
final String label; | ||
|
||
CustomNavigationRailDestination({ | ||
required this.icon, | ||
required this.label, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter/widgets.dart'; | ||
import 'package:remix/remix.dart'; | ||
|
||
class SDButton extends StatelessWidget { | ||
const SDButton({ | ||
required this.onPressed, | ||
super.key, | ||
required this.label, | ||
this.icon, | ||
}); | ||
|
||
final VoidCallback onPressed; | ||
final String label; | ||
|
||
final IconData? icon; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return RxButton( | ||
onPressed: onPressed, | ||
type: ButtonVariant.surface, | ||
iconLeft: icon, | ||
label: '', | ||
); | ||
} | ||
} | ||
|
||
class SDIconButton extends StatelessWidget { | ||
const SDIconButton({ | ||
required this.onPressed, | ||
super.key, | ||
required this.icon, | ||
this.selected = false, | ||
}); | ||
|
||
final VoidCallback onPressed; | ||
final bool selected; | ||
|
||
final IconData icon; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return RxButton( | ||
onPressed: onPressed, | ||
type: selected ? ButtonVariant.surface : ButtonVariant.ghost, | ||
iconLeft: icon, | ||
size: ButtonSize.large, | ||
label: '', | ||
); | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
/// A dialog page with Material entrance and exit animations, modal barrier color, | ||
/// and modal barrier behavior (dialog is dismissible with a tap on the barrier). | ||
class DialogPage<T> extends Page<T> { | ||
final Offset? anchorPoint; | ||
final Color? barrierColor; | ||
final bool barrierDismissible; | ||
final String? barrierLabel; | ||
final bool useSafeArea; | ||
final CapturedThemes? themes; | ||
final WidgetBuilder builder; | ||
|
||
const DialogPage({ | ||
required this.builder, | ||
this.anchorPoint, | ||
this.barrierColor = Colors.black54, | ||
this.barrierDismissible = true, | ||
this.barrierLabel, | ||
this.useSafeArea = true, | ||
this.themes, | ||
super.key, | ||
super.name, | ||
super.arguments, | ||
super.restorationId, | ||
}); | ||
|
||
@override | ||
Route<T> createRoute(BuildContext context) { | ||
return DialogRoute<T>( | ||
context: context, | ||
settings: this, | ||
builder: builder, | ||
anchorPoint: anchorPoint, | ||
barrierColor: barrierColor, | ||
barrierDismissible: barrierDismissible, | ||
barrierLabel: barrierLabel, | ||
useSafeArea: useSafeArea, | ||
themes: themes, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:go_router/go_router.dart'; | ||
import 'package:go_router_paths/go_router_paths.dart'; | ||
|
||
import '../../superdeck.dart'; | ||
import '../helpers/dialog_page.dart'; | ||
import '../screens/export_screen.dart'; | ||
import '../screens/presentation_screen.dart'; | ||
|
||
class SDPaths { | ||
static Path get presentation => Path('/'); | ||
static ExportPath get export => ExportPath(); | ||
|
||
static Param<Param> get slides => Param('slides', 'page'); | ||
} | ||
|
||
class ExportPath extends Path<ExportPath> { | ||
ExportPath() : super('export'); | ||
|
||
Path get low => Path('low', parent: this); | ||
Path get good => Path('good', parent: this); | ||
Path get better => Path('better', parent: this); | ||
Path get best => Path('best', parent: this); | ||
} | ||
|
||
final _rootNavigatorKey = GlobalKey<NavigatorState>(debugLabel: 'root'); | ||
final _sectionANavigatorKey = | ||
GlobalKey<NavigatorState>(debugLabel: 'sectionANav'); | ||
|
||
final goRouterConfig = GoRouter( | ||
navigatorKey: _rootNavigatorKey, | ||
initialLocation: '/', | ||
routes: <RouteBase>[ | ||
StatefulShellRoute.indexedStack( | ||
builder: (context, state, navigationShell) { | ||
return AppShell(navigationShell: navigationShell); | ||
}, | ||
branches: [ | ||
// The route branch for the first tab of the bottom navigation bar. | ||
StatefulShellBranch( | ||
navigatorKey: _sectionANavigatorKey, | ||
routes: [ | ||
GoRoute( | ||
path: SDPaths.presentation.goRoute, | ||
builder: (context, state) => const PresentationScreen(), | ||
), | ||
], | ||
), | ||
StatefulShellBranch( | ||
routes: [ | ||
GoRoute( | ||
path: SDPaths.export.goRoute, | ||
pageBuilder: (context, state) { | ||
return DialogPage( | ||
builder: (_) => Dialog( | ||
child: ExportScreen(), | ||
), | ||
barrierColor: Colors.black54, // Optional, as it's the default | ||
barrierDismissible: true, // Optional, as it's the default | ||
); | ||
}, | ||
), | ||
], | ||
), | ||
], | ||
), | ||
], | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
dependency_overrides: | ||
mix: | ||
path: ../../../mix/packages/mix | ||
mix_generator: | ||
path: ../../../mix/packages/mix_generator | ||
mix_lint: | ||
path: ../../../mix/packages/mix_lint | ||
mix_annotations: | ||
path: ../../../mix/packages/mix_annotations | ||
remix: | ||
path: ../../../mix/packages/remix |