Виджет GridTileBar
Виджет GridTileBar ставят в footer или header
у
GridTile.
Заголовок - title,
подзаголовок - subtitle,
иконки - leading и trailing,
фон - backgroundColor.
Синтаксис
GridTileBar(
title: Text('abcde'),
subtitle: Text('12345'),
backgroundColor: Colors.black54,
)
Параметры
| Параметр | Описание |
|---|---|
title |
Главная строка на полосе. |
subtitle |
Вторая строка под title. |
backgroundColor |
Цвет фона полосы. |
Пример
Давайте оформим footer GridTile:
import 'package:flutter/material.dart';
void main()
{
runApp(
MaterialApp(
home: Scaffold(
body: Center(
child: SizedBox(
width: 180,
height: 180,
child: GridTile(
child: ColoredBox(color: Colors.teal),
footer: GridTileBar(
title: Text('abcde'),
),
),
),
),
),
),
);
}
Внизу ячейки полоса с 'abcde'.
Пример
Давайте добавим trailing IconButton:
import 'package:flutter/material.dart';
void main()
{
runApp(
MaterialApp(
home: Scaffold(
body: GridTile(
child: Container(color: Colors.orange),
footer: GridTileBar(
title: Text('12345'),
trailing: IconButton(
onPressed: () {},
icon: Icon(Icons.play_arrow),
),
),
),
),
),
);
}
Справа на полосе кнопка воспроизведения.