Flutter
Flutter
import 'dart:html';
import 'package:flutter/material.dart';
void main()
{
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
Container(
margin: EdgeInsets.all(20),
child: FlatButton(
child: Text('Click here'),
color: Colors.redAccent,
textColor: Colors.white,
onPressed: () {},
),
alignment:Alignment.topLeft,
),
]))),
);
}}
Output:
2A)
void main() => runApp(SnackBarDemo());
class SnackBarDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter SnackBar',
home: Scaffold(
appBar: AppBar(
title: Text('Flutter SnackBar'),
),
body: SnackBarPage(),
),
);
}
}
@override
Widget build(BuildContext context) {
return Center(
child: RaisedButton(
onPressed: () {
final snackBar = SnackBar(
content: Text('How is it?'),
action: SnackBarAction(
label: 'Undo',
onPressed: () {
// do something
},
),
);
// Find the Scaffold in the Widget tree and use it to show a
SnackBar!
Scaffold.of(context).showSnackBar(snackBar);
},
child: Text('Show SnackBar'),
),
);
}
}
OUTPUT:
3A)
@override
Widget build (BuildContext xontext){
return Column(
children : <Widget> [
Icon();
Text('$note),
FlatButton(
onPressed : _onPressed,
),
],
);
}
}