Created
May 24, 2025 23:05
-
-
Save fredgrott/509e86d463b476e7c9eb3061dd2aff52 to your computer and use it in GitHub Desktop.
flex pane notifier
This file contains hidden or 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
// Copyright 2025 Fredrick Allan Grott. All rights reserved. | |
// Use of this source code is governed by a BSD-style | |
// license that can be found in the LICENSE file. | |
import 'package:flutter/material.dart'; | |
import 'package:userinterface/core/widgets/canonical_layout_models.dart'; | |
/// FlexPaneNotitier is to pass the FlexPaneModel view-model | |
/// as an observer into the two pane canonical layout. | |
/// | |
/// Generally as | |
/// ```dart | |
/// return FlexPaneNotifier( | |
/// notifier: FlexPaneModel, | |
/// child: Builder(builder: (BuildContext context){ | |
/// return Containr() | |
/// ``` | |
/// | |
/// For both the Axis direction value and the seam rect value | |
/// the reference used will be: | |
/// ```dart | |
/// FlexPaneNotifier.of(context).appDirection; | |
/// | |
/// FlexPaneNotifier.of(context).appSeamRect; | |
/// ``` | |
/// | |
/// @author Fredrick Allan Grott | |
class FlexPaneNotifier extends InheritedNotifier<FlexPaneModel> { | |
const FlexPaneNotifier({ | |
super.key, | |
super.notifier, | |
required super.child, | |
}); | |
static FlexPaneModel? of(BuildContext context){ | |
return context.dependOnInheritedWidgetOfExactType<FlexPaneNotifier>()!.notifier; | |
} | |
@override | |
bool updateShouldNotify(FlexPaneNotifier oldState) { | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment