From 4d88503c2b0bf5a908fcbd5cd80122a0507fca36 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Sat, 6 May 2023 00:16:07 +0530 Subject: [PATCH] Extract widget in separate file --- lib/ui/common/report_bug.dart | 1 - lib/ui/home/speed_dial_label_widget.dart | 29 ++++++++++++++++++++++++ lib/ui/home_page.dart | 28 +---------------------- 3 files changed, 30 insertions(+), 28 deletions(-) create mode 100644 lib/ui/home/speed_dial_label_widget.dart diff --git a/lib/ui/common/report_bug.dart b/lib/ui/common/report_bug.dart index f4eca12743..48f0691b04 100644 --- a/lib/ui/common/report_bug.dart +++ b/lib/ui/common/report_bug.dart @@ -1,6 +1,5 @@ import 'package:ente_auth/utils/email_util.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; PopupMenuButton reportBugPopupMenu(BuildContext context) { return PopupMenuButton( diff --git a/lib/ui/home/speed_dial_label_widget.dart b/lib/ui/home/speed_dial_label_widget.dart new file mode 100644 index 0000000000..40c945893e --- /dev/null +++ b/lib/ui/home/speed_dial_label_widget.dart @@ -0,0 +1,29 @@ +import 'package:ente_auth/ente_theme_data.dart'; +import 'package:flutter/material.dart'; + +class SpeedDialLabelWidget extends StatelessWidget { + final String label; + + const SpeedDialLabelWidget( + this.label, { + Key? key, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Container( + margin: const EdgeInsets.all(4), + padding: const EdgeInsets.all(12), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + color: Theme.of(context).colorScheme.fabBackgroundColor, + ), + child: Text( + label, + style: TextStyle( + color: Theme.of(context).colorScheme.fabForegroundColor, + ), + ), + ); + } +} diff --git a/lib/ui/home_page.dart b/lib/ui/home_page.dart index 7e628dbc74..6a626ec7a8 100644 --- a/lib/ui/home_page.dart +++ b/lib/ui/home_page.dart @@ -15,6 +15,7 @@ import 'package:ente_auth/store/code_store.dart'; import 'package:ente_auth/ui/account/logout_dialog.dart'; import 'package:ente_auth/ui/code_widget.dart'; import 'package:ente_auth/ui/common/loading_widget.dart'; +import 'package:ente_auth/ui/home/speed_dial_label_widget.dart'; import 'package:ente_auth/ui/scanner_page.dart'; import 'package:ente_auth/ui/settings_page.dart'; import 'package:flutter/material.dart'; @@ -397,30 +398,3 @@ class _HomePageState extends State { ); } } - -class SpeedDialLabelWidget extends StatelessWidget { - final String label; - - const SpeedDialLabelWidget( - this.label, { - Key? key, - }) : super(key: key); - - @override - Widget build(BuildContext context) { - return Container( - margin: const EdgeInsets.all(4), - padding: const EdgeInsets.all(12), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8), - color: Theme.of(context).colorScheme.fabBackgroundColor, - ), - child: Text( - label, - style: TextStyle( - color: Theme.of(context).colorScheme.fabForegroundColor, - ), - ), - ); - } -}