Skip to content

Commit

Permalink
fix: 4228 - max lines 2 and tooltip for edit image buttons (#4939)
Browse files Browse the repository at this point in the history
  • Loading branch information
monsieurtanuki committed Jan 7, 2024
1 parent c76715d commit 46271ca
Showing 1 changed file with 29 additions and 21 deletions.
50 changes: 29 additions & 21 deletions packages/smooth_app/lib/pages/product/edit_image_button.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart';
import 'package:smooth_app/generic_lib/design_constants.dart';

Expand All @@ -18,28 +19,35 @@ class EditImageButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
final ColorScheme colorScheme = Theme.of(context).colorScheme;
return OutlinedButton.icon(
icon: Icon(iconData),
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(colorScheme.onPrimary),
shape: MaterialStateProperty.all(
const RoundedRectangleBorder(borderRadius: ROUNDED_BORDER_RADIUS),
),
side: borderWidth == null
? null
: MaterialStateBorderSide.resolveWith(
(_) => BorderSide(
color: colorScheme.primary,
width: borderWidth!,
return Tooltip(
message: label,
child: OutlinedButton.icon(
icon: Icon(iconData),
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(colorScheme.onPrimary),
shape: MaterialStateProperty.all(
const RoundedRectangleBorder(borderRadius: ROUNDED_BORDER_RADIUS),
),
side: borderWidth == null
? null
: MaterialStateBorderSide.resolveWith(
(_) => BorderSide(
color: colorScheme.primary,
width: borderWidth!,
),
),
),
),
onPressed: onPressed,
label: SizedBox(
width: double.infinity,
child: Padding(
padding: EdgeInsets.all(borderWidth ?? 0),
child: Text(label),
),
onPressed: onPressed,
label: SizedBox(
width: double.infinity,
child: Padding(
padding: EdgeInsets.all(borderWidth ?? 0),
child: AutoSizeText(
label,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
),
),
),
);
Expand Down

0 comments on commit 46271ca

Please sign in to comment.