Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Restore bounded family form layout

Neeraj Gupta276b51504c90
diff --git a/mobile/apps/photos/lib/ui/family/family_ui.dart b/mobile/apps/photos/lib/ui/family/family_ui.dart
index 04a5ae7d5d..28375d807c 100644
--- a/mobile/apps/photos/lib/ui/family/family_ui.dart
+++ b/mobile/apps/photos/lib/ui/family/family_ui.dart
@@ -1,11 +1,13 @@
import 'package:ente_components/ente_components.dart';
import 'package:flutter/material.dart';
+import 'package:photos/theme/ente_theme.dart';
class FamilyPageScaffold extends StatelessWidget {
const FamilyPageScaffold({
required this.child,
this.title,
this.actions = const [],
+ this.scrollable = false,
this.padding = const EdgeInsets.fromLTRB(16, 12, 16, 16),
super.key,
});
@@ -13,12 +15,14 @@ class FamilyPageScaffold extends StatelessWidget {
final Widget child;
final String? title;
final List<Widget> actions;
+ final bool scrollable;
final EdgeInsetsGeometry padding;
@override
Widget build(BuildContext context) {
final backgroundColor = context.componentColors.backgroundBase;
- if (title != null) {
+ if (scrollable) {
+ assert(title != null);
return Scaffold(
backgroundColor: backgroundColor,
body: AppBarComponent(
@@ -35,6 +39,7 @@ class FamilyPageScaffold extends StatelessWidget {
);
}
+ final textTheme = getEnteTextTheme(context);
return Scaffold(
backgroundColor: backgroundColor,
body: SafeArea(
@@ -57,6 +62,9 @@ class FamilyPageScaffold extends StatelessWidget {
),
),
),
+ if (title != null) const SizedBox(width: 8),
+ if (title != null)
+ Expanded(child: Text(title!, style: textTheme.largeBold)),
],
),
const SizedBox(height: 16),
diff --git a/mobile/apps/photos/test/ui/family/family_ui_test.dart b/mobile/apps/photos/test/ui/family/family_ui_test.dart
new file mode 100644
index 0000000000..634b311ccc
--- /dev/null
+++ b/mobile/apps/photos/test/ui/family/family_ui_test.dart
@@ -0,0 +1,26 @@
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:photos/ente_theme_data.dart';
+import 'package:photos/ui/family/family_ui.dart';
+
+void main() {
+ testWidgets('keeps titled form content vertically bounded', (tester) async {
+ await tester.pumpWidget(
+ MaterialApp(
+ theme: lightThemeData,
+ home: const FamilyPageScaffold(
+ title: 'Family form',
+ child: Column(
+ children: [
+ Expanded(child: SizedBox.expand()),
+ SizedBox(height: 48),
+ ],
+ ),
+ ),
+ ),
+ );
+
+ expect(tester.takeException(), isNull);
+ expect(find.text('Family form'), findsOneWidget);
+ });
+}