Skip to content

Commit 4aae908

Browse files
committed
feat: show editing option name in bottom bar for easier access
1 parent b5c912e commit 4aae908

File tree

4 files changed

+57
-7
lines changed

4 files changed

+57
-7
lines changed

lib/image_builder/layers/background.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:flutter/material.dart';
2+
import 'package:heartry/image_builder/widgets/editing_option.dart';
23

34
import '../../widgets/color_picker_dialog.dart';
45
import '../../widgets/gradient_palette_selector.dart';
@@ -36,7 +37,8 @@ class SolidBackgroundLayer extends ImageLayer {
3637
@override
3738
List<Widget> getEditingOptions(BuildContext context) {
3839
return [
39-
IconButton(
40+
EditingOption(
41+
option: "Background",
4042
icon: Icon(Icons.texture_rounded),
4143
tooltip: "Background Color",
4244
onPressed: () {
@@ -101,7 +103,8 @@ class GradientBackgroundLayer extends ImageLayer {
101103
@override
102104
List<Widget> getEditingOptions(BuildContext context) {
103105
return [
104-
IconButton(
106+
EditingOption(
107+
option: "Background",
105108
icon: Icon(Icons.gradient_rounded),
106109
tooltip: "Background Gradient",
107110
onPressed: () {

lib/image_builder/layers/text.dart

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:flutter/material.dart';
2+
import 'package:heartry/image_builder/widgets/editing_option.dart';
23
import '../core/font_family.dart';
34
import 'package:material_symbols_icons/symbols.dart';
45

@@ -45,7 +46,8 @@ class TextLayer extends ImageLayer {
4546
final colorScheme = Theme.of(context).colorScheme;
4647

4748
return [
48-
IconButton(
49+
EditingOption(
50+
option: "Text Color",
4951
icon: Icon(Icons.format_color_text_rounded),
5052
tooltip: "Text Color",
5153
onPressed: () {
@@ -68,7 +70,8 @@ class TextLayer extends ImageLayer {
6870
);
6971
},
7072
),
71-
IconButton(
73+
EditingOption(
74+
option: "Text Size",
7275
icon: Icon(Icons.format_size_rounded),
7376
tooltip: "Text Size",
7477
onPressed: () {
@@ -89,7 +92,8 @@ class TextLayer extends ImageLayer {
8992
);
9093
},
9194
),
92-
IconButton(
95+
EditingOption(
96+
option: "Font Family",
9397
icon: Icon(Symbols.font_download_rounded),
9498
tooltip: "Font Family",
9599
onPressed: () {
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import 'package:flutter/material.dart';
2+
3+
class EditingOption extends StatelessWidget {
4+
const EditingOption({
5+
super.key,
6+
required this.option,
7+
required this.icon,
8+
required this.onPressed,
9+
required this.tooltip,
10+
});
11+
12+
final String option, tooltip;
13+
final Widget icon;
14+
final VoidCallback onPressed;
15+
16+
@override
17+
Widget build(BuildContext context) {
18+
return InkWell(
19+
borderRadius: BorderRadius.circular(8.0),
20+
onTap: onPressed,
21+
child: Tooltip(
22+
message: tooltip,
23+
child: Padding(
24+
padding: const EdgeInsets.symmetric(horizontal: 4.0),
25+
child: Column(
26+
mainAxisSize: MainAxisSize.min,
27+
mainAxisAlignment: MainAxisAlignment.center,
28+
spacing: 5,
29+
children: [
30+
icon,
31+
Text(
32+
option,
33+
style: Theme.of(context).textTheme.bodySmall,
34+
),
35+
],
36+
),
37+
),
38+
),
39+
);
40+
}
41+
}

lib/screens/image_screen/image_screen.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import 'package:share_plus/share_plus.dart';
99

1010
import '../../image_builder/core/image_controller.dart';
1111
import '../../image_builder/templates/template.dart';
12+
import '../../image_builder/widgets/editing_option.dart';
1213
import '../../image_builder/widgets/page_details.dart';
1314
import '../share_images_screen/share_images_screen.dart';
1415

@@ -101,8 +102,9 @@ class _ImageScreenState extends State<ImageScreen> {
101102
child: Row(
102103
children: [
103104
Padding(
104-
padding: const EdgeInsets.all(8.0),
105-
child: IconButton(
105+
padding: const EdgeInsets.symmetric(horizontal: 8.0),
106+
child: EditingOption(
107+
option: "Templates",
106108
tooltip: "Change Template",
107109
icon: const Icon(Symbols.stacks),
108110
onPressed: () {

0 commit comments

Comments
 (0)