Преглед на файлове

Add widget that renders the current endpoint app is connecting to

vishnukvmd преди 1 година
родител
ревизия
54c4862e71
променени са 2 файла, в които са добавени 29 реда и са изтрити 0 реда
  1. 27 0
      mobile/lib/ui/settings/developer_settings_widget.dart
  2. 2 0
      mobile/lib/ui/settings_page.dart

+ 27 - 0
mobile/lib/ui/settings/developer_settings_widget.dart

@@ -0,0 +1,27 @@
+import 'package:flutter/material.dart';
+import "package:photos/core/configuration.dart";
+import "package:photos/core/constants.dart";
+import "package:photos/generated/l10n.dart";
+
+class DeveloperSettingsWidget extends StatelessWidget {
+  const DeveloperSettingsWidget({super.key});
+
+  @override
+  Widget build(BuildContext context) {
+    final endpoint = Configuration.instance.getHttpEndpoint();
+    if (endpoint != kDefaultProductionEndpoint) {
+      final endpointURI = Uri.parse(endpoint);
+      return Padding(
+        padding: const EdgeInsets.only(bottom: 20),
+        child: Text(
+          S.of(context).customEndpoint(
+            "${endpointURI.host}:${endpointURI.port}",
+          ),
+          style: Theme.of(context).textTheme.bodySmall,
+        ),
+      );
+    } else {
+      return const SizedBox.shrink();
+    }
+  }
+}

+ 2 - 0
mobile/lib/ui/settings_page.dart

@@ -18,6 +18,7 @@ import 'package:photos/ui/settings/account_section_widget.dart';
 import 'package:photos/ui/settings/app_version_widget.dart';
 import 'package:photos/ui/settings/backup/backup_section_widget.dart';
 import 'package:photos/ui/settings/debug_section_widget.dart';
+import "package:photos/ui/settings/developer_settings_widget.dart";
 import 'package:photos/ui/settings/general_section_widget.dart';
 import 'package:photos/ui/settings/inherited_settings_state.dart';
 import 'package:photos/ui/settings/security_section_widget.dart';
@@ -144,6 +145,7 @@ class SettingsPage extends StatelessWidget {
       contents.addAll([sectionSpacing, const DebugSectionWidget()]);
     }
     contents.add(const AppVersionWidget());
+    contents.add(const DeveloperSettingsWidget());
     contents.add(
       const Padding(
         padding: EdgeInsets.only(bottom: 60),