Drop redundant `ToggleButtonsStateManager` instances (#1305)

pull/1309/head
Brett Morgan 3 years ago committed by GitHub
parent e3040c9e36
commit addafa93ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -310,13 +310,7 @@ class _MyHomePageState extends State<MyHomePage> {
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ToggleButtonsStateManager(
isToggleButtonsSelected: _isSelected,
updateToggleButtonsStateOnButtonPressed:
_updateToggleButtonsStateOnButtonPressed,
updateToggleButtonStateOnSelectionChanged:
_updateToggleButtonsStateOnSelectionChanged,
child: Builder(builder: (innerContext) {
Builder(builder: (innerContext) {
final ToggleButtonsStateManager manager =
ToggleButtonsStateManager.of(innerContext);
@ -331,8 +325,8 @@ class _MyHomePageState extends State<MyHomePage> {
manager.toggleButtonsState
.contains(ToggleButtonsState.underline),
],
onPressed: (index) => manager
.updateToggleButtonsOnButtonPressed(index),
onPressed: (index) =>
manager.updateToggleButtonsOnButtonPressed(index),
children: const [
Icon(Icons.format_bold),
Icon(Icons.format_italic),
@ -340,19 +334,12 @@ class _MyHomePageState extends State<MyHomePage> {
],
);
}),
),
],
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 35.0),
child: ToggleButtonsStateManager(
isToggleButtonsSelected: _isSelected,
updateToggleButtonsStateOnButtonPressed:
_updateToggleButtonsStateOnButtonPressed,
updateToggleButtonStateOnSelectionChanged:
_updateToggleButtonsStateOnSelectionChanged,
child: TextEditingDeltaHistoryManager(
history: _textEditingDeltaHistory,
updateHistoryOnInput: _updateTextEditingDeltaHistory,
@ -365,7 +352,6 @@ class _MyHomePageState extends State<MyHomePage> {
),
),
),
),
Expanded(
child: Column(
children: [

Loading…
Cancel
Save