feat(example): improve example perfomance
This commit is contained in:
parent
739738fb0d
commit
bb0fc895e0
|
|
@ -9,48 +9,38 @@ class CardView extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Card(
|
return Container(
|
||||||
child: Stack(
|
padding: const EdgeInsets.all(16.0),
|
||||||
children: <Widget>[
|
|
||||||
SizedBox.expand(
|
|
||||||
child: Material(
|
|
||||||
borderRadius: BorderRadius.circular(12.0),
|
|
||||||
child: Container(
|
|
||||||
color: Colors.blueAccent,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox.expand(
|
|
||||||
child: Container(
|
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
gradient: LinearGradient(
|
gradient: LinearGradient(
|
||||||
colors: [Colors.transparent, Colors.black54],
|
begin: Alignment.topCenter,
|
||||||
begin: Alignment.center,
|
end: Alignment.bottomCenter,
|
||||||
end: Alignment.bottomCenter)),
|
stops: [
|
||||||
|
0.5,
|
||||||
|
1,
|
||||||
|
],
|
||||||
|
colors: [
|
||||||
|
Colors.blueAccent,
|
||||||
|
Color.fromARGB(255, 6, 28, 61),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Align(
|
|
||||||
alignment: Alignment.bottomLeft,
|
|
||||||
child: Container(
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
vertical: 16.0, horizontal: 16.0),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(text,
|
Text(
|
||||||
|
text,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 20.0,
|
fontSize: 20.0,
|
||||||
fontWeight: FontWeight.w700)),
|
fontWeight: FontWeight.w700),
|
||||||
|
),
|
||||||
const Padding(padding: EdgeInsets.only(bottom: 8.0)),
|
const Padding(padding: EdgeInsets.only(bottom: 8.0)),
|
||||||
Text("$text details",
|
Text("$text details",
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
style: const TextStyle(color: Colors.white)),
|
style: const TextStyle(color: Colors.white)),
|
||||||
],
|
],
|
||||||
)),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,13 +31,10 @@ class MyHomePage extends StatefulWidget {
|
||||||
|
|
||||||
class _MyHomePageState extends State<MyHomePage> {
|
class _MyHomePageState extends State<MyHomePage> {
|
||||||
int counter = 4;
|
int counter = 4;
|
||||||
|
final cardController = SwipeableCardSectionController();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
//create a CardController
|
|
||||||
SwipeableCardSectionController cardController =
|
|
||||||
SwipeableCardSectionController();
|
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(widget.title),
|
title: Text(widget.title),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue