@@ -1740,11 +1740,7 @@ abstract class _Banner extends StatelessWidget {
17401740 /// https://github.com/zulip/zulip-flutter/pull/1432#discussion_r2023907300
17411741 ///
17421742 /// 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);
17481744
17491745 /// Whether to apply `end: 8` in [SafeArea.minimum] .
17501746 ///
@@ -1816,7 +1812,7 @@ class _ErrorBanner extends _Banner {
18161812 _BannerIntent get intent => _BannerIntent .danger;
18171813
18181814 @override
1819- Widget ? buildTrailing (pageContext ) {
1815+ Widget ? buildTrailing (context ) {
18201816 // An "x" button can go here.
18211817 // 24px square with 8px touchable padding in all directions?
18221818 // and `bool get padEnd => false`; see Figma:
@@ -1837,7 +1833,11 @@ class _EditMessageBanner extends _Banner {
18371833 @override
18381834 _BannerIntent get intent => _BannerIntent .info;
18391835
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+
18411841 final store = PerAccountStoreWidget .of (pageContext);
18421842 final controller = composeBoxState.controller;
18431843 if (controller is ! EditMessageComposeBoxController ) return ; // TODO(log)
@@ -1884,16 +1884,16 @@ class _EditMessageBanner extends _Banner {
18841884 }
18851885
18861886 @override
1887- Widget buildTrailing (pageContext ) {
1888- final zulipLocalizations = ZulipLocalizations .of (pageContext );
1887+ Widget buildTrailing (context ) {
1888+ final zulipLocalizations = ZulipLocalizations .of (context );
18891889 return Row (mainAxisSize: MainAxisSize .min, spacing: 8 , children: [
18901890 ZulipWebUiKitButton (label: zulipLocalizations.composeBoxBannerButtonCancel,
18911891 onPressed: composeBoxState.endEditInteraction),
18921892 // TODO(#1481) disabled appearance when there are validation errors
18931893 // or the original raw content hasn't loaded yet
18941894 ZulipWebUiKitButton (label: zulipLocalizations.composeBoxBannerButtonSave,
18951895 attention: ZulipWebUiKitButtonAttention .high,
1896- onPressed: () => _handleTapSave (pageContext )),
1896+ onPressed: () => _handleTapSave (context )),
18971897 ]);
18981898 }
18991899}
0 commit comments