@@ -310,6 +310,7 @@ void _showMainMenu(BuildContext context, {
310310 crossAxisAlignment: CrossAxisAlignment .stretch,
311311 mainAxisSize: MainAxisSize .min,
312312 children: [
313+ _OrganizationHeader (),
313314 Flexible (child: InsetShadowBox (
314315 top: 8 , bottom: 8 ,
315316 color: designVariables.bgBotBar,
@@ -326,6 +327,84 @@ void _showMainMenu(BuildContext context, {
326327 });
327328}
328329
330+ class _OrganizationHeader extends StatelessWidget {
331+ @override
332+ Widget build (BuildContext context) {
333+ final store = PerAccountStoreWidget .of (context);
334+ final designVariables = DesignVariables .of (context);
335+ final zulipLocalizations = ZulipLocalizations .of (context);
336+
337+ String organizationName = store.realmName;
338+ Uri ? organizationIcon = store.tryResolveUrl (store.realmIcon);
339+ final buttonStyle = TextButton .styleFrom (
340+ splashFactory: NoSplash .splashFactory,
341+ overlayColor: Colors .transparent
342+ );
343+
344+ return Padding (
345+ padding: const EdgeInsets .symmetric (vertical: 8 , horizontal: 16 ),
346+ child: Row (
347+ mainAxisAlignment: MainAxisAlignment .spaceBetween,
348+ children: [
349+ Expanded (
350+ child: Row (
351+ children: [
352+ Image .network (
353+ organizationIcon.toString (),
354+ width: 28 ,
355+ height: 28 ,
356+ fit: BoxFit .contain,
357+ errorBuilder: (context, error, stackTrace) {
358+ return const SizedBox (
359+ width: 28 ,
360+ height: 28 ,
361+ child: Placeholder (),
362+ );
363+ },
364+ loadingBuilder: (context, child, loadingProgress) {
365+ if (loadingProgress == null ) return child;
366+ return const SizedBox (
367+ width: 28 ,
368+ height: 28 ,
369+ child: CircularProgressIndicator (),
370+ );
371+ },
372+ ),
373+ const SizedBox (width: 8 ),
374+ Expanded (
375+ child: Text (
376+ organizationName,
377+ style: const TextStyle (
378+ fontWeight: FontWeight .bold,
379+ fontSize: 20 ,
380+ ),
381+ overflow: TextOverflow .ellipsis,
382+ maxLines: 1 ,
383+ ),
384+ ),
385+ ],
386+ ),
387+ ),
388+ TextButton (
389+ onPressed: () {
390+ Navigator .of (context).push (MaterialWidgetRoute (page: const ChooseAccountPage ()));
391+ },
392+ style: buttonStyle,
393+ child: Text (
394+ zulipLocalizations.organizationsButtonLabel,
395+ style: TextStyle (
396+ fontSize: 19 ,
397+ fontWeight: FontWeight .w500,
398+ color: designVariables.icon,
399+ ),
400+ ),
401+ ),
402+ ],
403+ ),
404+ );
405+ }
406+ }
407+
329408abstract class _MenuButton extends StatelessWidget {
330409 const _MenuButton ();
331410
0 commit comments