From 5d49aa8f5279a57a8eff670e315a20788ea8df90 Mon Sep 17 00:00:00 2001 From: Dewmal Date: Sun, 29 Mar 2020 21:48:28 +0530 Subject: [PATCH] Add auto text widget --- lib/page/screen/root_screen.dart | 2 ++ lib/page/screen/user_register_screen.dart | 1 + lib/widgets/custom_text.dart | 3 ++- pubspec.lock | 7 +++++++ pubspec.yaml | 2 ++ 5 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/page/screen/root_screen.dart b/lib/page/screen/root_screen.dart index 26203b2..e5f6241 100644 --- a/lib/page/screen/root_screen.dart +++ b/lib/page/screen/root_screen.dart @@ -173,6 +173,7 @@ class _RootScreenState extends State { ], title: CustomText( _appName, + isChangeFontSize: false, style: TextStyle( color: Colors.black, fontWeight: FontWeight.bold, @@ -185,6 +186,7 @@ class _RootScreenState extends State { backgroundColor: Colors.white, title: CustomText( _homeTabItems[_currentIndex].title, + isChangeFontSize: false, style: TextStyle( color: Colors.black, fontWeight: FontWeight.bold, diff --git a/lib/page/screen/user_register_screen.dart b/lib/page/screen/user_register_screen.dart index df51317..844c668 100644 --- a/lib/page/screen/user_register_screen.dart +++ b/lib/page/screen/user_register_screen.dart @@ -102,6 +102,7 @@ class _UserRegisterScreenState extends State { title: CustomText( AppLocalizations.of(context) .translate('user_register_bar_title_text'), + isChangeFontSize: false, style: TextStyle(color: Colors.black))), body: CustomScrollView( slivers: [ diff --git a/lib/widgets/custom_text.dart b/lib/widgets/custom_text.dart index 00b8e99..134f97a 100644 --- a/lib/widgets/custom_text.dart +++ b/lib/widgets/custom_text.dart @@ -1,5 +1,6 @@ import 'dart:ffi'; +import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/material.dart'; import 'package:selftrackingapp/app_localizations.dart'; @@ -22,7 +23,7 @@ class CustomText extends StatelessWidget { style = style.copyWith(fontSize: fontSize); } - return Text( + return AutoSizeText( data, textAlign: textAlign, style: style, diff --git a/pubspec.lock b/pubspec.lock index 831ee43..346bb57 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -22,6 +22,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.4.0" + auto_size_text: + dependency: "direct main" + description: + name: auto_size_text + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" boolean_selector: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 0ca6160..32c825b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -42,6 +42,8 @@ dependencies: dropdown_banner: ^1.4.0 recursive_regex: ^0.1.3+2 webview_flutter: ^0:3:19+9 + auto_size_text: ^2.1.0 + flutter_localizations: sdk: flutter