From 1249776a21f9b85a8073733f0594e4403106a7ca Mon Sep 17 00:00:00 2001 From: 21pages Date: Mon, 24 Oct 2022 15:58:24 +0800 Subject: [PATCH] add auto-size-text for installCard button Signed-off-by: 21pages --- .../lib/desktop/pages/desktop_home_page.dart | 3 +- flutter/lib/desktop/widgets/button.dart | 105 ++++++++++++++++-- flutter/pubspec.lock | 37 +++--- flutter/pubspec.yaml | 1 + 4 files changed, 121 insertions(+), 25 deletions(-) diff --git a/flutter/lib/desktop/pages/desktop_home_page.dart b/flutter/lib/desktop/pages/desktop_home_page.dart index d22f740cb..7d2690626 100644 --- a/flutter/lib/desktop/pages/desktop_home_page.dart +++ b/flutter/lib/desktop/pages/desktop_home_page.dart @@ -377,7 +377,8 @@ class _DesktopHomePageState extends State fontSize: 13), ).marginOnly(bottom: 20), Row(mainAxisAlignment: MainAxisAlignment.center, children: [ - Button( + FixedWidthButton( + width: 150, padding: 8, isOutline: true, text: translate(btnText), diff --git a/flutter/lib/desktop/widgets/button.dart b/flutter/lib/desktop/widgets/button.dart index 695302a9e..0c09f7c77 100644 --- a/flutter/lib/desktop/widgets/button.dart +++ b/flutter/lib/desktop/widgets/button.dart @@ -1,18 +1,19 @@ +import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import '../../common.dart'; class Button extends StatefulWidget { - GestureTapCallback onTap; - String text; - double? textSize; - double? minWidth; - bool isOutline; - double? padding; - Color? textColor; - double? radius; - Color? borderColor; + final GestureTapCallback onTap; + final String text; + final double? textSize; + final double? minWidth; + final bool isOutline; + final double? padding; + final Color? textColor; + final double? radius; + final Color? borderColor; Button({ Key? key, @@ -82,3 +83,89 @@ class _ButtonState extends State