Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide the text of tab items when they're not selected #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ build/
ios/.generated/
ios/Flutter/Generated.xcconfig
ios/Runner/GeneratedPluginRegistrant.*
**/ios/Flutter/flutter_export_environment.sh


# Created by https://www.gitignore.io/api/java,xcode,swift,kotlin,flutter,intellij,objective-c,androidstudio,visualstudiocode
Expand Down Expand Up @@ -404,4 +405,4 @@ playground.xcworkspace
/*.gcno
**/xcshareddata/WorkspaceSettings.xcsettings

# End of https://www.gitignore.io/api/java,xcode,swift,kotlin,flutter,intellij,objective-c,androidstudio,visualstudiocode
# End of https://www.gitignore.io/api/java,xcode,swift,kotlin,flutter,intellij,objective-c,androidstudio,visualstudiocode
34 changes: 22 additions & 12 deletions lib/internal/tab_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ const int ANIM_DURATION = 300;
class TabItem extends StatelessWidget {
TabItem(
{@required this.uniqueKey,
@required this.selected,
@required this.iconData,
@required this.title,
@required this.callbackFunction,
@required this.textColor,
@required this.iconColor});
@required this.selected,
@required this.iconData,
@required this.title,
@required this.callbackFunction,
@required this.textColor,
@required this.iconColor});

final UniqueKey uniqueKey;
final String title;
Expand Down Expand Up @@ -44,12 +44,22 @@ class TabItem extends StatelessWidget {
alignment: Alignment(0, (selected) ? TEXT_ON : TEXT_OFF),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
title,
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
fontWeight: FontWeight.w600, color: textColor),
child: AnimatedDefaultTextStyle(
duration: Duration(milliseconds: ANIM_DURATION),
style: selected
? TextStyle(
fontWeight: FontWeight.w600,
color: textColor,
)
: TextStyle(
fontWeight: FontWeight.w600,
color: Colors.transparent,
),
child: Text(
title,
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
),
)),
),
Expand Down
82 changes: 69 additions & 13 deletions pubspec.lock
Original file line number Diff line number Diff line change
@@ -1,20 +1,34 @@
# Generated by pub
# See https://www.dartlang.org/tools/pub/glossary#lockfile
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
archive:
dependency: transitive
description:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.11"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.2"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
version: "2.4.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
version: "1.0.5"
charcode:
dependency: transitive
description:
Expand All @@ -29,6 +43,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.11"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
flutter:
dependency: "direct main"
description: flutter
Expand All @@ -39,20 +67,27 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
image:
dependency: transitive
description:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.3+1"
version: "0.12.6"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
version: "1.1.8"
mockito:
dependency: "direct dev"
description:
Expand All @@ -66,14 +101,28 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.2"
version: "1.6.4"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0+1"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "2.0.5"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -85,7 +134,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.1"
version: "1.5.5"
stack_trace:
dependency: transitive
description:
Expand All @@ -99,28 +148,28 @@ packages:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.8"
version: "2.0.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
version: "1.0.5"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
version: "1.1.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.1"
version: "0.2.11"
typed_data:
dependency: transitive
description:
Expand All @@ -135,5 +184,12 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.5.0"
sdks:
dart: ">=2.0.0 <3.0.0"
dart: ">=2.4.0 <3.0.0"