Skip to content

Instantly share code, notes, and snippets.

@isaacadariku
Created November 3, 2020 09:02
Show Gist options
  • Save isaacadariku/1a9b2170ed6367bb59c47c6d20ce1101 to your computer and use it in GitHub Desktop.
Save isaacadariku/1a9b2170ed6367bb59c47c6d20ce1101 to your computer and use it in GitHub Desktop.
A sample card
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Container(child: Center(child: B4eva())),
);
}
}
class B4eva extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
height: 150,
width: 300,
child: Stack(
clipBehavior: Clip.none,
children: [
Card(
child: Padding(
padding: const EdgeInsets.all(14.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
RichText(
text: TextSpan(
children: <TextSpan>[
TextSpan(
text: 'Jane Doe ',
style: TextStyle(color: Colors.grey)),
TextSpan(
text: '- Business',
style: TextStyle(
fontWeight: FontWeight.w900, color: Colors.black),
),
],
),
),
SizedBox(height: 12),
Text(
'FCTA 34,700',
style: TextStyle(color: Colors.green, fontSize: 14),
),
SizedBox(height: 20),
Expanded(child: Divider()),
SizedBox(height: 5),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'New Transfer',
style: TextStyle(color: Colors.green),
),
Text(
'Recharge',
style: TextStyle(fontWeight: FontWeight.w900),
),
],
)
],
),
),
),
Positioned(
top: -20,
left: 8,
child: Card(
elevation: 4,
color: Colors.green,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 22.0, vertical: 18.0),
child: Center(
child: Text(
"\$",
style: TextStyle(color: Colors.white, fontSize: 20),
),
),
),
),
),
],
),
);
}
}
@isaacadariku
Copy link
Author

Screenshot 2020-11-03 at 10 00 45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment