Timed status message; accept visibility changes in the application.
TxToast
| Parameter | Type | Default | Meaning |
|---|---|---|---|
| visible | bool | required | Controls visibility. |
| message | String | required | Notification text. |
| onVisibleChanged | ValueChanged<bool>? | null | Reports visible; update controlled state in the callback. |
| type | TxToastType | TxToastType.info | Appearance/input type; see the signature for allowed values. |
| displayTime | Duration | const Duration(milliseconds: 3500) | Display duration; 0 or Duration.zero stays open. |
| Member / type / return | Meaning |
|---|---|
static void show(BuildContext context, String message, {TxToastType type = TxToastType.info, Duration displayTime = const Duration(milliseconds: 3500)}) | Opens the native overlay alternative; follow the return contract in the signature. |
import 'package:flutter/material.dart';
import 'package:tecexpress/tecexpress.dart';
Widget example() {
var visible = false;
return StatefulBuilder(
builder: (context, setState) => Column(mainAxisSize: MainAxisSize.min, children: [TxButton(text: 'Notify', onPressed: () => setState(() => visible = true)), TxToast(visible: visible, message: 'Saved', onVisibleChanged: (v) => setState(() => visible = v))]),
);
}import 'package:flutter/material.dart';
import 'package:tecexpress/tecexpress.dart';
void showToast(BuildContext context) {
TxToast.show(context, 'Saved', type: TxToastType.success);
}