mirror of
				https://gitlab.com/comunic/comunicmobile
				synced 2025-11-04 12:14:11 +00:00 
			
		
		
		
	Move "About Comunic" dialog
This commit is contained in:
		@@ -1,5 +1,6 @@
 | 
			
		||||
import 'package:comunic/helpers/preferences_helper.dart';
 | 
			
		||||
import 'package:comunic/utils/intl_utils.dart';
 | 
			
		||||
import 'package:comunic/utils/ui_utils.dart';
 | 
			
		||||
import 'package:flutter/material.dart';
 | 
			
		||||
 | 
			
		||||
/// Application settings route
 | 
			
		||||
@@ -61,6 +62,10 @@ class __AppSettingsBodyState extends State<_AppSettingsBody> {
 | 
			
		||||
            description:
 | 
			
		||||
                tr("You will need to restart the application to apply changes"),
 | 
			
		||||
          ),
 | 
			
		||||
          ListTile(
 | 
			
		||||
            title: Text(tr("About Comunic")),
 | 
			
		||||
            onTap: () => showAboutAppDialog(context),
 | 
			
		||||
          ),
 | 
			
		||||
        ],
 | 
			
		||||
      ),
 | 
			
		||||
    );
 | 
			
		||||
 
 | 
			
		||||
@@ -126,11 +126,6 @@ class _MainRouteState extends MainController {
 | 
			
		||||
        _openAccountsSettings();
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
      /// Show about dialog
 | 
			
		||||
      case BarCallbackActions.OPEN_ABOUT_DIALOG:
 | 
			
		||||
        showAboutAppDialog(context);
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
      /// Logout user
 | 
			
		||||
      case BarCallbackActions.ACTION_LOGOUT:
 | 
			
		||||
        _logoutRequested();
 | 
			
		||||
 
 | 
			
		||||
@@ -28,7 +28,6 @@ enum BarCallbackActions {
 | 
			
		||||
  OPEN_ACCOUNT_SETTINGS,
 | 
			
		||||
  OPEN_APP_SETTINGS,
 | 
			
		||||
  OPEN_USER_FRIENDS_LIST,
 | 
			
		||||
  OPEN_ABOUT_DIALOG,
 | 
			
		||||
  OPEN_CONVERSATION,
 | 
			
		||||
  NONE,
 | 
			
		||||
  ACTION_LOGOUT
 | 
			
		||||
@@ -103,8 +102,6 @@ final _menuActionsItem = <_ActionMenuItem>[
 | 
			
		||||
      action: BarCallbackActions.OPEN_ACCOUNT_SETTINGS),
 | 
			
		||||
  _ActionMenuItem(
 | 
			
		||||
      label: tr("App settings"), action: BarCallbackActions.OPEN_APP_SETTINGS),
 | 
			
		||||
  _ActionMenuItem(
 | 
			
		||||
      label: tr("About Comunic"), action: BarCallbackActions.OPEN_ABOUT_DIALOG),
 | 
			
		||||
  _ActionMenuItem(
 | 
			
		||||
      label: tr("Sign out"), action: BarCallbackActions.ACTION_LOGOUT),
 | 
			
		||||
];
 | 
			
		||||
@@ -128,7 +125,7 @@ class ComunicAppBar extends StatefulWidget implements PreferredSizeWidget {
 | 
			
		||||
 | 
			
		||||
class _ComunicAppBarState extends SafeState<ComunicAppBar> {
 | 
			
		||||
  var _unreadNotifications =
 | 
			
		||||
  CountUnreadNotifications(notifications: 0, conversations: 0);
 | 
			
		||||
      CountUnreadNotifications(notifications: 0, conversations: 0);
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  void initState() {
 | 
			
		||||
@@ -137,9 +134,9 @@ class _ComunicAppBarState extends SafeState<ComunicAppBar> {
 | 
			
		||||
 | 
			
		||||
    // Listen to notifications number update
 | 
			
		||||
    this.listenChangeState<NewNumberNotifsEvent>(
 | 
			
		||||
            (d) => _unreadNotifications.notifications = d.newNum);
 | 
			
		||||
        (d) => _unreadNotifications.notifications = d.newNum);
 | 
			
		||||
    this.listenChangeState<NewNumberUnreadConversations>(
 | 
			
		||||
            (d) => _unreadNotifications.conversations = d.newNum);
 | 
			
		||||
        (d) => _unreadNotifications.conversations = d.newNum);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  void _refreshCountUnread() async {
 | 
			
		||||
@@ -179,8 +176,7 @@ class _ComunicAppBarState extends SafeState<ComunicAppBar> {
 | 
			
		||||
        crossAxisAlignment: CrossAxisAlignment.stretch,
 | 
			
		||||
        children: List.generate(
 | 
			
		||||
          _menuItems.length,
 | 
			
		||||
              (i) =>
 | 
			
		||||
              _MenuItemWidget(
 | 
			
		||||
          (i) => _MenuItemWidget(
 | 
			
		||||
            item: _menuItems[i],
 | 
			
		||||
            onTap: widget.onTap,
 | 
			
		||||
            isSelected: _menuItems[i].action == widget.selectedAction,
 | 
			
		||||
@@ -221,9 +217,9 @@ class _MenuItemWidget extends StatelessWidget {
 | 
			
		||||
        color: isSelected ? _secondaryColor() : _primaryColor(),
 | 
			
		||||
        child: !item.isMenu
 | 
			
		||||
            ? InkWell(
 | 
			
		||||
          child: _buildIconContainer(),
 | 
			
		||||
          onTap: () => onTap(item.action),
 | 
			
		||||
        )
 | 
			
		||||
                child: _buildIconContainer(),
 | 
			
		||||
                onTap: () => onTap(item.action),
 | 
			
		||||
              )
 | 
			
		||||
            : _buildContextMenuPopupButton(),
 | 
			
		||||
      ),
 | 
			
		||||
    );
 | 
			
		||||
@@ -244,15 +240,15 @@ class _MenuItemWidget extends StatelessWidget {
 | 
			
		||||
        newNotice == 0
 | 
			
		||||
            ? Container()
 | 
			
		||||
            : Material(
 | 
			
		||||
            color: Colors.red,
 | 
			
		||||
            child: Padding(
 | 
			
		||||
              padding: const EdgeInsets.all(2.0),
 | 
			
		||||
              child: Text(" $newNotice ",
 | 
			
		||||
                  style: TextStyle(color: Colors.white)),
 | 
			
		||||
            ),
 | 
			
		||||
            borderRadius: BorderRadius.all(
 | 
			
		||||
              Radius.circular(50.0),
 | 
			
		||||
            )),
 | 
			
		||||
                color: Colors.red,
 | 
			
		||||
                child: Padding(
 | 
			
		||||
                  padding: const EdgeInsets.all(2.0),
 | 
			
		||||
                  child: Text(" $newNotice ",
 | 
			
		||||
                      style: TextStyle(color: Colors.white)),
 | 
			
		||||
                ),
 | 
			
		||||
                borderRadius: BorderRadius.all(
 | 
			
		||||
                  Radius.circular(50.0),
 | 
			
		||||
                )),
 | 
			
		||||
        Spacer(flex: 2),
 | 
			
		||||
      ],
 | 
			
		||||
    );
 | 
			
		||||
@@ -264,9 +260,9 @@ class _MenuItemWidget extends StatelessWidget {
 | 
			
		||||
      child: _buildIconContainer(),
 | 
			
		||||
      itemBuilder: (i) => _menuActionsItem
 | 
			
		||||
          .map((f) => PopupMenuItem(
 | 
			
		||||
        child: Text(f.label),
 | 
			
		||||
        value: f.action,
 | 
			
		||||
      ))
 | 
			
		||||
                child: Text(f.label),
 | 
			
		||||
                value: f.action,
 | 
			
		||||
              ))
 | 
			
		||||
          .toList(),
 | 
			
		||||
      onSelected: onTap,
 | 
			
		||||
    );
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user