Hello Everyone!
Here I am working on a small project which is a gallery application, I managed to display the album along with its thumbnail.
I also want to display the name and total files of the album that I have got from my local gallery with the GridTileBar
which the album name is on the left and the total files are on the right,
for my left I managed to display the album name using the title
property but, for the right one which is the total file, I can't display it using the trailing
property and strangely when I try to display the Icon
Widget, the icon appears and is right beside the album name that I have displayed.
Result from flutter doctor
[?] Flutter (Channel stable, 1.22.5, on Linux, locale en_US.UTF-8)
[?] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[!] Android Studio (not installed)
[?] Connected device (1 available)
! Doctor found issues in 1 category.
Tools
Debugging on My actual device which is Xiaomi Redmi 1S Android 7.1 Nougat
Expectation
Reality
Code album_card.dart
import 'dart:io';
import "package:flutter/material.dart";
class AlbumCard extends StatelessWidget {
AlbumCard(
{@required this.albumName, this.thumbnail, this.totalFiles, this.isOdd});
final String albumName;
final int totalFiles;
final File thumbnail;
final bool isOdd;
@override
Widget build(BuildContext context) {
return Card(
margin: EdgeInsets.all(0),
clipBehavior: Clip.antiAliasWithSaveLayer,
child: GridTile(
child: Image.file(
thumbnail,
fit: BoxFit.cover,
),
footer: GridTileBar(
backgroundColor: Colors.black45,
title: Text('$albumName'),
// Won't work if displaying a Text Widget but Work if it's an Icon Widget
trailing: Text('$totalFiles'),
),
));
}
}
question from:
https://stackoverflow.com/questions/65641414/using-a-text-widget-on-the-trailing-property-is-not-shown-in-the-gridtilebar-w 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…