Skip to content

Instantly share code, notes, and snippets.

@zalviandyr
Last active May 22, 2023 04:52
Show Gist options
  • Save zalviandyr/6b3a1948c8ce91537226f10912760b30 to your computer and use it in GitHub Desktop.
Save zalviandyr/6b3a1948c8ce91537226f10912760b30 to your computer and use it in GitHub Desktop.
Counter example
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key}) : super(key: key);
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Container(
margin: const EdgeInsets.symmetric(horizontal: 10),
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
border: Border.all(color: Colors.grey),
borderRadius: BorderRadius.circular(20),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
children: const [
Icon(Icons.remove_red_eye),
SizedBox(width: 10),
Text('Transaction'),
Spacer(),
Text('Details'),
],
),
const SizedBox(height: 10),
const Divider(color: Colors.grey),
const SizedBox(height: 10),
SizedBox(
height: 40,
child: Row(
children: [
Row(
children: [
const Icon(Icons.arrow_upward),
const SizedBox(width: 10),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
Text('Incoming'),
SizedBox(height: 5),
Text(
'Rp. 5.000.000',
style: TextStyle(fontWeight: FontWeight.bold),
),
],
),
],
),
const Spacer(),
Container(
// height: 40,
height: double.infinity,
width: 1,
color: Colors.grey,
),
const Spacer(),
Row(
children: [
const Icon(Icons.arrow_upward),
const SizedBox(width: 10),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
Text('Incoming'),
SizedBox(height: 5),
Text(
'Rp. 5.000.000',
style: TextStyle(fontWeight: FontWeight.bold),
),
],
),
],
),
],
),
),
],
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment