@@ -1740,11 +1740,7 @@ abstract class _Banner extends StatelessWidget {
1740
1740
/// https://github.com/zulip/zulip-flutter/pull/1432#discussion_r2023907300
1741
1741
///
1742
1742
/// To control the element's distance from the end edge, override [padEnd] .
1743
- ///
1744
- /// The passed [BuildContext] will be the result of [PageRoot.contextOf] ,
1745
- /// so it's expected to remain mounted until the whole page disappears,
1746
- /// which may be long after the banner disappears.
1747
- Widget ? buildTrailing (BuildContext pageContext);
1743
+ Widget ? buildTrailing (BuildContext context);
1748
1744
1749
1745
/// Whether to apply `end: 8` in [SafeArea.minimum] .
1750
1746
///
@@ -1816,7 +1812,7 @@ class _ErrorBanner extends _Banner {
1816
1812
_BannerIntent get intent => _BannerIntent .danger;
1817
1813
1818
1814
@override
1819
- Widget ? buildTrailing (pageContext ) {
1815
+ Widget ? buildTrailing (context ) {
1820
1816
// An "x" button can go here.
1821
1817
// 24px square with 8px touchable padding in all directions?
1822
1818
// and `bool get padEnd => false`; see Figma:
@@ -1837,7 +1833,11 @@ class _EditMessageBanner extends _Banner {
1837
1833
@override
1838
1834
_BannerIntent get intent => _BannerIntent .info;
1839
1835
1840
- void _handleTapSave (BuildContext pageContext) async {
1836
+ void _handleTapSave (BuildContext context) async {
1837
+ // (A BuildContext that's expected to remain mounted until the whole page
1838
+ // disappears, which may be long after the banner disappears.)
1839
+ final pageContext = PageRoot .contextOf (context);
1840
+
1841
1841
final store = PerAccountStoreWidget .of (pageContext);
1842
1842
final controller = composeBoxState.controller;
1843
1843
if (controller is ! EditMessageComposeBoxController ) return ; // TODO(log)
@@ -1884,16 +1884,16 @@ class _EditMessageBanner extends _Banner {
1884
1884
}
1885
1885
1886
1886
@override
1887
- Widget buildTrailing (pageContext ) {
1888
- final zulipLocalizations = ZulipLocalizations .of (pageContext );
1887
+ Widget buildTrailing (context ) {
1888
+ final zulipLocalizations = ZulipLocalizations .of (context );
1889
1889
return Row (mainAxisSize: MainAxisSize .min, spacing: 8 , children: [
1890
1890
ZulipWebUiKitButton (label: zulipLocalizations.composeBoxBannerButtonCancel,
1891
1891
onPressed: composeBoxState.endEditInteraction),
1892
1892
// TODO(#1481) disabled appearance when there are validation errors
1893
1893
// or the original raw content hasn't loaded yet
1894
1894
ZulipWebUiKitButton (label: zulipLocalizations.composeBoxBannerButtonSave,
1895
1895
attention: ZulipWebUiKitButtonAttention .high,
1896
- onPressed: () => _handleTapSave (pageContext )),
1896
+ onPressed: () => _handleTapSave (context )),
1897
1897
]);
1898
1898
}
1899
1899
}
0 commit comments