Skip to content

Instantly share code, notes, and snippets.

@Abdelkrim
Created May 10, 2020 23:46
Show Gist options
  • Save Abdelkrim/f3ec216320f2c70345cc42528bc013b2 to your computer and use it in GitHub Desktop.
Save Abdelkrim/f3ec216320f2c70345cc42528bc013b2 to your computer and use it in GitHub Desktop.
Flutter, inherited widget understood from a Inherited Widgets Explained - Flutter Widgets 101 Ep. 3 on YouTube
// see https://www.youtube.com/watch?v=Zbm3hjPjQMk
import 'package:flutter/material.dart';
class InheritedSettings extends InheritedWidget{
final SettingsSwitchesStatefulWidget settingsSwitchesStatefulWidget;
final TechnicalInfoSection technicalInfoSection;
InheritedSettings({this.SettingsSwitchesStatefulWidget, Widget child}): super(child: child);
@override
bool updateShouldNotify(InheritedWidget oldWidget) => true;
static InheritedSettings of(BuildContext context) => context.inheritFromWidgetOfExactType(InheritedSettings);
}
class SettingsScreen extends StatelessWidget{
@override
Widget build(BuildContext context){
final settingsScreen = InheritedSettings.of(context);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment