Skip to content

Commit

Permalink
Add auto text widget
Browse files Browse the repository at this point in the history
  • Loading branch information
dewmal committed Mar 29, 2020
1 parent c2edf7a commit 5d49aa8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/page/screen/root_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ class _RootScreenState extends State<RootScreen> {
],
title: CustomText(
_appName,
isChangeFontSize: false,
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
Expand All @@ -185,6 +186,7 @@ class _RootScreenState extends State<RootScreen> {
backgroundColor: Colors.white,
title: CustomText(
_homeTabItems[_currentIndex].title,
isChangeFontSize: false,
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
Expand Down
1 change: 1 addition & 0 deletions lib/page/screen/user_register_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ class _UserRegisterScreenState extends State<UserRegisterScreen> {
title: CustomText(
AppLocalizations.of(context)
.translate('user_register_bar_title_text'),
isChangeFontSize: false,
style: TextStyle(color: Colors.black))),
body: CustomScrollView(
slivers: <Widget>[
Expand Down
3 changes: 2 additions & 1 deletion lib/widgets/custom_text.dart
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -22,7 +23,7 @@ class CustomText extends StatelessWidget {
style = style.copyWith(fontSize: fontSize);
}

return Text(
return AutoSizeText(
data,
textAlign: textAlign,
style: style,
Expand Down
7 changes: 7 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5d49aa8

Please sign in to comment.