Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
SnackBar class
A lightweight message with an optional action which briefly displays at the bottom of the screen.
A SnackBar with an action will not time out when TalkBack or VoiceOver are enabled. This is controlled
by AccessibilityFeatures.accessibleNavigation.
Constructors
SnackBar({Key key, @required Widget content, Color backgroundColor, double elevation, ShapeBorder s
hape, SnackBarBehavior behavior, SnackBarAction action, Duration duration: _snackBarDisplayDuration,
Animation<double> animation })
Const
Card class
A material design card. A card has slightly rounded corners and a shadow.
A card is a sheet of Material used to represent some related information, for example an album, a
geographical location, a meal, contact details, etc.
Constructors
Card({Key key, Color color, double elevation, ShapeBorder shape, bool borderOnForeground: true, EdgeI
nsetsGeometry margin, Clip clipBehavior, Widget child, bool semanticContainer: true })
const
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
@override
Widget build(BuildContext context) {
return MaterialApp(
title: _title,
home: Scaffold(
appBar: AppBar(title: const Text(_title)),
body: MyStatelessWidget(),
),
);
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
MyStatelessWidget({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Center(
child: Card(
color: Color.fromRGBO(10, 10, 100, 0.6),
elevation: 10.2,
margin: EdgeInsets.all(7),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
const ListTile(
leading: Icon(Icons.business),
title: Text('The Jodn Doe Show'),
subtitle: Text('Presented by One and Only John Doe'),
),
ButtonTheme.bar(
// make buttons use the appropriate styles for cards
child: ButtonBar(
children: <Widget>[
RaisedButton(
child: const Text('BUY TICKETS'),
onPressed: () {/* ... */},
color: Colors.green,
textColor: Colors.white,
),
RaisedButton(
child: const Text('Show me Anohter Show'),
onPressed: () {/* ... */},
color: Colors.red,
textColor: Colors.white,
),
],
),
),
],
),
),
);
}
}
/// SnackBar Code Example
import 'package:flutter/material.dart';
void main() => runApp(SnackBarDemo());
var ctr=0;
class SnackBarDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'SnackBar Demo',
home: Scaffold(
appBar: AppBar(
title: Text('SnackBar Demo Pressed Times : $ctr'),
),
body: SnackBarPage(),
),
);
}
}
https://api.flutter.dev/flutter/material/SnackBar-class.html