Skip to content

Commit

Permalink
Outlined basic architecture for WizardNode
Browse files Browse the repository at this point in the history
  • Loading branch information
rlch committed Jul 10, 2021
1 parent b7fae2e commit af72261
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 36 deletions.
40 changes: 39 additions & 1 deletion lib/src/wizard.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
import 'package:flutter/material.dart';
import 'wizard_scope.dart';

//! Instead of implementing all the Focus classes + widgets, maybe we should
//! create widgets that manage their construction / lifecycle. The API is really
//! difficult to abstract.
//! difficult to abstract.

//? We don't actually need to add anything to the Focus classes themselves;
// objects like FocusTraversalPolicy should be working out-of-the-box, so it's
// probably a better idea to avoid this approach altogether.

/// Represents an indiviudal node in the Feature Discovery.
///
/// [WizardNode] manages a [FocusNode], which, when instantiated; should be a
/// descendant of a [WizardScope].
class WizardNode extends StatelessWidget {
const WizardNode({
required this.child,
this.focusNode,
this.background,
this.overlay,
Key? key,
}) : super(key: key);

final Widget child;
final Widget? background;
final Widget? overlay;

/// Parameters passed down to [Focus]. The lifecycle of a [focusNode] should
/// be managed inside the [Widget] it's instantiated in. If a [FocusNode] is
/// not provided, [Focus] will implicitly create and manage one.
final FocusNode? focusNode;

@override
Widget build(BuildContext context) {
return Focus(
focusNode: focusNode,
child: child,
);
}
}
5 changes: 0 additions & 5 deletions lib/src/wizard_node.dart

This file was deleted.

12 changes: 4 additions & 8 deletions lib/src/wizard_scope.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import 'package:flutter/cupertino.dart';
import 'package:wizardview/src/wizard.dart';

import 'wizard_scope_node.dart';

class WizardScope extends FocusScope {
class WizardScope {
const WizardScope({
required Widget child,
required this.node,
}) : super(
child: child,
node: node,
);
});

final WizardScopeNode node;
final WizardNode node;
}
22 changes: 0 additions & 22 deletions lib/src/wizard_scope_node.dart

This file was deleted.

0 comments on commit af72261

Please sign in to comment.