Skip to content

Commit

Permalink
Fix appbar title for chat list screen
Browse files Browse the repository at this point in the history
  • Loading branch information
nqhhdev authored and hoangdat committed Sep 27, 2023
1 parent e53a479 commit 8ed95b4
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 42 deletions.
88 changes: 50 additions & 38 deletions lib/widgets/twake_components/twake_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,41 +37,49 @@ class TwakeHeader extends StatelessWidget
padding: TwakeHeaderStyle.padding,
child: Row(
children: [
if (selectMode == SelectMode.select)
Row(
Expanded(
flex: 3,
child: Row(
children: [
InkWell(
onTap: onClearSelection,
child: Padding(
padding: TwakeHeaderStyle.closeIconPadding,
child: Icon(
Icons.close,
size: TwakeHeaderStyle.closeIconSize,
color: Theme.of(context)
.colorScheme
.onSurfaceVariant,
),
borderRadius: BorderRadius.circular(
TwakeHeaderStyle.closeIconSize,
),
child: Icon(
Icons.close,
size: TwakeHeaderStyle.closeIconSize,
color: selectMode == SelectMode.select
? Theme.of(context).colorScheme.onSurfaceVariant
: Colors.transparent,
),
),
ValueListenableBuilder(
valueListenable: conversationSelectionNotifier,
builder: (context, conversationSelection, _) {
return Text(
conversationSelection.length.toString(),
style: Theme.of(context)
.textTheme
.bodyLarge
?.copyWith(
color: Theme.of(context)
.colorScheme
.onSurfaceVariant,
),
return Padding(
padding: TwakeHeaderStyle.counterSelectionPadding,
child: Text(
conversationSelection.length.toString(),
style: Theme.of(context)
.textTheme
.bodyLarge
?.copyWith(
color: selectMode == SelectMode.select
? Theme.of(context)
.colorScheme
.onSurfaceVariant
: Colors.transparent,
),
),
);
},
),
],
),
),
Expanded(
flex: 6,
child: Align(
alignment: Alignment.center,
child: Text(
Expand All @@ -83,25 +91,29 @@ class TwakeHeader extends StatelessWidget
),
),
if (!TwakeHeaderStyle.isDesktop(context))
InkWell(
borderRadius: BorderRadius.circular(
TwakeHeaderStyle.textBorderRadius,
),
onTap: openSelectMode,
Expanded(
flex: 3,
child: Align(
alignment: Alignment.centerRight,
child: Padding(
padding: TwakeHeaderStyle.textButtonPadding,
child: Text(
selectMode == SelectMode.normal
? L10n.of(context)!.edit
: L10n.of(context)!.done,
style: Theme.of(context)
.textTheme
.labelLarge
?.copyWith(
color: Theme.of(context).colorScheme.primary,
),
child: InkWell(
borderRadius: BorderRadius.circular(
TwakeHeaderStyle.textBorderRadius,
),
onTap: openSelectMode,
child: Padding(
padding: TwakeHeaderStyle.textButtonPadding,
child: Text(
selectMode == SelectMode.normal
? L10n.of(context)!.edit
: L10n.of(context)!.done,
style: Theme.of(context)
.textTheme
.labelLarge
?.copyWith(
color:
Theme.of(context).colorScheme.primary,
),
),
),
),
),
Expand Down
8 changes: 4 additions & 4 deletions lib/widgets/twake_components/twake_header_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ class TwakeHeaderStyle {
}

static const EdgeInsetsDirectional padding = EdgeInsetsDirectional.only(
end: 16,
start: 16,
end: 4,
start: 4,
);

static const EdgeInsetsDirectional textButtonPadding =
EdgeInsetsDirectional.all(8);

static const EdgeInsetsDirectional closeIconPadding =
EdgeInsetsDirectional.only(end: 4);
static const EdgeInsetsDirectional counterSelectionPadding =
EdgeInsetsDirectional.only(start: 4);
}

0 comments on commit 8ed95b4

Please sign in to comment.