Skip to content

Commit c22c141

Browse files
committed
TF-2421 Update new UI for app bar email list view
Signed-off-by: dab246 <[email protected]>
1 parent 780b84b commit c22c141

File tree

19 files changed

+285
-341
lines changed

19 files changed

+285
-341
lines changed

assets/images/ic_mailbox_menu.svg

Lines changed: 5 additions & 0 deletions
Loading

assets/images/ic_menu_mailbox.svg

Lines changed: 0 additions & 5 deletions
This file was deleted.

core/lib/core.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ export 'presentation/views/floating_button/scrolling_floating_button_animated.da
7575
export 'presentation/views/html_viewer/html_content_viewer_on_web_widget.dart';
7676
export 'presentation/views/html_viewer/html_content_viewer_widget.dart';
7777
export 'presentation/views/image/avatar_builder.dart';
78-
export 'presentation/views/image/icon_builder.dart';
7978
export 'presentation/views/list/sliver_grid_delegate_fixed_height.dart';
8079
export 'presentation/views/list/tree_view.dart';
8180
export 'presentation/views/loading/cupertino_loading_widget.dart';

core/lib/presentation/resources/image_paths.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ class ImagePaths {
181181
String get icAvatarPersonal => _getImagePath('ic_avatar_personal.svg');
182182
String get icAvatarPersonalDelivering => _getImagePath('ic_avatar_personal_delivering.svg');
183183
String get icDialogOfflineMode => _getImagePath('ic_dialog_offline_mode.svg');
184-
String get icMenuMailbox => _getImagePath('ic_menu_mailbox.svg');
184+
String get icMailboxMenu => _getImagePath('ic_mailbox_menu.svg');
185185
String get icDelivering => _getImagePath('ic_delivering.svg');
186186
String get icError => _getImagePath('ic_error.svg');
187187
String get icConnectedInternet => _getImagePath('ic_connected_internet.svg');

core/lib/presentation/utils/theme_utils.dart

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,17 @@ class ThemeUtils {
2727
fontSize: 17,
2828
letterSpacing: -0.15,
2929
),
30-
bodyMedium: TextStyle(color: AppColor.baseTextColor),
31-
bodySmall: TextStyle(color: AppColor.baseTextColor),
30+
titleLarge: TextStyle(
31+
color: Colors.black,
32+
fontWeight: FontWeight.bold,
33+
fontSize: 28
34+
),
35+
bodyMedium: TextStyle(
36+
fontWeight: FontWeight.w500,
37+
),
38+
bodySmall: TextStyle(
39+
fontWeight: FontWeight.w500
40+
),
3241
headlineLarge: TextStyle(
3342
fontWeight: FontWeight.w600,
3443
fontSize: 32,
Lines changed: 65 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,78 @@
11
import 'package:core/presentation/extensions/color_extension.dart';
22
import 'package:flutter/material.dart';
33

4-
typedef OnTapAvatarActionClick = void Function();
5-
typedef OnTapAvatarActionWithPositionClick = void Function(RelativeRect? position);
4+
typedef OnTapActionClick = void Function();
5+
typedef OnTapWithPositionAction = void Function(RelativeRect position);
66

7-
class AvatarBuilder {
7+
class AvatarBuilder extends StatelessWidget {
8+
final String? text;
9+
final double? size;
10+
final Color? bgColor;
11+
final Color? textColor;
12+
final OnTapActionClick? onTapAction;
13+
final OnTapWithPositionAction? onTapWithPositionAction;
14+
final List<Color>? avatarColors;
15+
final List<BoxShadow>? boxShadows;
16+
final TextStyle? textStyle;
817

9-
BuildContext? _context;
10-
Key? _key;
11-
String? _text;
12-
double? _size;
13-
Color? _bgColor;
14-
Color? _textColor;
15-
OnTapAvatarActionClick? _onTapAvatarActionClick;
16-
OnTapAvatarActionWithPositionClick? _onTapAvatarActionWithPositionClick;
17-
List<Color>? _avatarColors;
18-
List<BoxShadow>? _boxShadows;
19-
TextStyle? _textStyle;
18+
const AvatarBuilder({
19+
super.key,
20+
this.text,
21+
this.size,
22+
this.bgColor,
23+
this.textColor,
24+
this.onTapAction,
25+
this.onTapWithPositionAction,
26+
this.avatarColors,
27+
this.boxShadows,
28+
this.textStyle
29+
});
2030

21-
void key(Key key) {
22-
_key = key;
23-
}
24-
25-
void context(BuildContext context) {
26-
_context = context;
27-
}
28-
29-
void size(double size) {
30-
_size = size;
31-
}
32-
33-
void text(String text) {
34-
_text = text;
35-
}
36-
37-
void backgroundColor(Color bgColor) {
38-
_bgColor = bgColor;
39-
}
40-
41-
void textColor(Color textColor) {
42-
_textColor = textColor;
43-
}
44-
45-
void avatarColor(List<Color>? avatarColors) {
46-
_avatarColors = avatarColors;
47-
}
48-
49-
void addBoxShadows(List<BoxShadow>? boxShadows) {
50-
_boxShadows = boxShadows;
51-
}
52-
53-
void addTextStyle(TextStyle? textStyle) {
54-
_textStyle = textStyle;
55-
}
56-
57-
void addOnTapActionClick(OnTapAvatarActionClick onTapAvatarActionClick) {
58-
_onTapAvatarActionClick = onTapAvatarActionClick;
59-
}
60-
61-
void addOnTapAvatarActionWithPositionClick(OnTapAvatarActionWithPositionClick onTapAvatarActionWithPositionClick) {
62-
_onTapAvatarActionWithPositionClick = onTapAvatarActionWithPositionClick;
63-
}
64-
65-
Widget build() {
66-
return InkWell(
67-
onTap: () => _onTapAvatarActionClick != null ? _onTapAvatarActionClick!.call() : null,
68-
onTapDown: (detail) {
69-
if (_onTapAvatarActionWithPositionClick != null && _context != null) {
70-
final screenSize = MediaQuery.of(_context!).size;
71-
final offset = detail.globalPosition;
72-
final position = RelativeRect.fromLTRB(
73-
offset.dx,
74-
offset.dy,
75-
screenSize.width - offset.dx,
76-
screenSize.height - offset.dy,
77-
);
78-
_onTapAvatarActionWithPositionClick?.call(position);
79-
}
80-
},
81-
borderRadius: BorderRadius.circular((_size ?? 40) / 2),
82-
child: Container(
83-
key: _key,
84-
width: _size ?? 40,
85-
height: _size ?? 40,
86-
padding: EdgeInsets.zero,
87-
margin: EdgeInsets.zero,
31+
@override
32+
Widget build(BuildContext context) {
33+
return Material(
34+
type: MaterialType.transparency,
35+
child: InkWell(
36+
onTap: onTapAction,
37+
onTapDown: (detail) {
38+
if (onTapWithPositionAction != null) {
39+
final screenSize = MediaQuery.of(context).size;
40+
final offset = detail.globalPosition;
41+
final position = RelativeRect.fromLTRB(
42+
offset.dx,
43+
offset.dy,
44+
screenSize.width - offset.dx,
45+
screenSize.height - offset.dy,
46+
);
47+
onTapWithPositionAction!(position);
48+
}
49+
},
50+
customBorder: const CircleBorder(),
51+
child: Container(
52+
width: size ?? 40,
53+
height: size ?? 40,
8854
alignment: Alignment.center,
89-
decoration: BoxDecoration(
90-
borderRadius: BorderRadius.circular((_size ?? 40) * 0.5),
91-
border: Border.all(color: Colors.transparent),
92-
boxShadow: _boxShadows ?? [],
93-
gradient: _avatarColors?.isNotEmpty == true
94-
? LinearGradient(begin: Alignment.topCenter, end: Alignment.bottomCenter, tileMode: TileMode.decal, colors: _avatarColors ?? [])
95-
: null,
96-
color: _bgColor ?? AppColor.avatarColor
55+
decoration: ShapeDecoration(
56+
shape: const CircleBorder(),
57+
shadows: boxShadows ?? [],
58+
gradient: avatarColors?.isNotEmpty == true
59+
? LinearGradient(
60+
begin: Alignment.topCenter,
61+
end: Alignment.bottomCenter,
62+
tileMode: TileMode.decal,
63+
colors: avatarColors ?? [])
64+
: null,
65+
color: bgColor ?? AppColor.avatarColor
9766
),
9867
child: Text(
99-
_text ?? '',
100-
style: _textStyle ?? TextStyle(fontSize: 20, color: _textColor ?? AppColor.avatarTextColor, fontWeight: FontWeight.w500)
68+
text ?? '',
69+
style: textStyle ?? Theme.of(context).textTheme.bodyMedium?.copyWith(
70+
fontSize: 20,
71+
color: textColor ?? AppColor.avatarTextColor
72+
)
10173
)
74+
),
10275
),
10376
);
10477
}
105-
}
78+
}

core/lib/presentation/views/image/icon_builder.dart

Lines changed: 0 additions & 55 deletions
This file was deleted.

lib/features/base/widget/email_avatar_builder.dart

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,16 @@ class EmailAvatarBuilder extends StatelessWidget {
1616

1717
@override
1818
Widget build(BuildContext context) {
19-
return (AvatarBuilder()
20-
..text(emailSelected.getAvatarText())
21-
..size(48)
22-
..addTextStyle(const TextStyle(
23-
fontWeight: FontWeight.bold,
24-
fontSize: 21,
25-
color: Colors.white))
26-
..backgroundColor(AppColor.colorAvatar)
27-
..avatarColor(emailSelected.avatarColors))
28-
.build();
19+
return AvatarBuilder(
20+
text: emailSelected.getAvatarText(),
21+
size: 48,
22+
textStyle: const TextStyle(
23+
fontWeight: FontWeight.bold,
24+
fontSize: 21,
25+
color: Colors.white
26+
),
27+
bgColor: AppColor.colorAvatar,
28+
avatarColors: emailSelected.avatarColors,
29+
);
2930
}
3031
}

lib/features/email/presentation/widgets/email_address_bottom_sheet_builder.dart

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,16 @@ class EmailAddressBottomSheetBuilder {
8484
width: 24,
8585
height: 24,
8686
fit: BoxFit.fill))),
87-
(AvatarBuilder()
88-
..text(_emailAddress.asString().firstLetterToUpperCase)
89-
..size(64)
90-
..addTextStyle(const TextStyle(
91-
fontWeight: FontWeight.w600,
92-
fontSize: 23,
93-
color: Colors.white))
94-
..avatarColor(_emailAddress.avatarColors))
95-
.build(),
87+
AvatarBuilder(
88+
text: _emailAddress.asString().firstLetterToUpperCase,
89+
size: 64,
90+
textStyle: const TextStyle(
91+
fontWeight: FontWeight.w600,
92+
fontSize: 23,
93+
color: Colors.white
94+
),
95+
avatarColors: _emailAddress.avatarColors,
96+
),
9697
if (_emailAddress.displayName.isNotEmpty)
9798
Padding(
9899
padding: const EdgeInsets.only(

lib/features/email/presentation/widgets/email_address_dialog_builder.dart

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,21 @@ class EmailAddressDialogBuilder extends StatelessWidget {
6060
width: 24,
6161
height: 24,
6262
fit: BoxFit.fill))),
63-
Padding(padding: const EdgeInsets.symmetric(horizontal: 16),
64-
child: Center(child: (AvatarBuilder()
65-
..text(_emailAddress.asString().firstLetterToUpperCase)
66-
..size(64)
67-
..addTextStyle(const TextStyle(
63+
Padding(
64+
padding: const EdgeInsets.symmetric(horizontal: 16),
65+
child: Center(
66+
child: AvatarBuilder(
67+
text: _emailAddress.asString().firstLetterToUpperCase,
68+
size: 64,
69+
textStyle: const TextStyle(
6870
fontWeight: FontWeight.w600,
6971
fontSize: 23,
70-
color: Colors.white))
71-
..avatarColor(_emailAddress.avatarColors))
72-
.build())),
72+
color: Colors.white
73+
),
74+
avatarColors: _emailAddress.avatarColors,
75+
)
76+
)
77+
),
7378
if (_emailAddress.displayName.isNotEmpty)
7479
Padding(
7580
padding: const EdgeInsets.only(

0 commit comments

Comments
 (0)