@@ -310,6 +310,7 @@ void _showMainMenu(BuildContext context, {
310
310
crossAxisAlignment: CrossAxisAlignment .stretch,
311
311
mainAxisSize: MainAxisSize .min,
312
312
children: [
313
+ _OrganizationHeader (),
313
314
Flexible (child: InsetShadowBox (
314
315
top: 8 , bottom: 8 ,
315
316
color: designVariables.bgBotBar,
@@ -326,6 +327,72 @@ void _showMainMenu(BuildContext context, {
326
327
});
327
328
}
328
329
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 Icon (Icons .broken_image, size: 28 );
359
+ },
360
+ ),
361
+ const SizedBox (width: 8 ),
362
+ Expanded (
363
+ child: Text (
364
+ organizationName,
365
+ style: const TextStyle (
366
+ fontWeight: FontWeight .bold,
367
+ fontSize: 20 ,
368
+ ),
369
+ overflow: TextOverflow .ellipsis,
370
+ maxLines: 1 ,
371
+ ),
372
+ ),
373
+ ],
374
+ ),
375
+ ),
376
+ TextButton (
377
+ onPressed: () {
378
+ Navigator .of (context).push (MaterialWidgetRoute (page: const ChooseAccountPage ()));
379
+ },
380
+ style: buttonStyle,
381
+ child: Text (
382
+ zulipLocalizations.organizationsButtonLabel,
383
+ style: TextStyle (
384
+ fontSize: 19 ,
385
+ fontWeight: FontWeight .w500,
386
+ color: designVariables.icon,
387
+ ),
388
+ ),
389
+ ),
390
+ ],
391
+ ),
392
+ );
393
+ }
394
+ }
395
+
329
396
abstract class _MenuButton extends StatelessWidget {
330
397
const _MenuButton ();
331
398
0 commit comments