UI
1.pubspec.yaml
name: b
description: "A new Flutter project."
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1
environment:
sdk: '>=3.2.4 <4.0.0'
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
carousel_slider: ^5.0.0
animate_do: ^3.3.4
fl_chart: ^0.69.0
dev_dependencies:
flutter_test:
sdk: flutter
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^4.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter packages.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
main.dart
import 'package:flutter/material.dart';
import 'Screen/banking_home_screen.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return const MaterialApp(
debugShowCheckedModeBanner: false,
home: BankingHomeScreen(),
);
}
}
3. Screen/banking_home_screen.dart
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import '../Detail/transaction_item_detail.dart';
import 'master_card.dart';
import 'transaction_items.dart';
class BankingHomeScreen extends StatefulWidget {
const BankingHomeScreen({super.key});
@override
State createState() => _BankingHomeScreenState();
}
class _BankingHomeScreenState extends State {
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Column(
children: [
// for custom appbar
customAppBar(),
// for master card
SizedBox(
height: 340,
child: ListView(
padding: const EdgeInsets.symmetric(horizontal: 10),
scrollDirection: Axis.horizontal,
children: [
// for master card
MesterCard(
id: "**********34567",
balance: '\$600',
color: Colors.deepPurple,
),
MesterCard(
id: "**********54970",
balance: '\$60',
color: Colors.blueAccent,
),
MesterCard(
id: "**********50970",
balance: '\$300',
color: Colors.pinkAccent,
),
],
),
),
const SizedBox(height: 30),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 18),
child: Align(
alignment: Alignment.centerLeft,
child: Text(
"Transaction",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 35,
),
),
),
),
const SizedBox(height: 10),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 18,
),
child: ListView(
children: [
TransactionItems(
icon: Icons.flight_takeoff,
onTab: () {
Navigator.of(context)
.push(MaterialPageRoute(builder: (context)=> TransactionItemDetail()));
},
color: Colors.blue,
date: "24 feb",
remark: "Travelling",
time: "3 Day Ago",
total: "\$445.000"),
TransactionItems(
icon: Icons.fastfood,
onTab: () {},
color: Colors.orange,
date: "27 feb",
remark: "Food",
time: "Today",
total: "\$45.000"),
TransactionItems(
icon: Icons.man_outlined,
onTab: () {},
color: Colors.deepOrange,
date: "24 jan",
remark: "Yoga",
time: "1 Month Ago",
total: "\$445.000"),
],
),
),
),
],
)),
);
}
Padding customAppBar() {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"My Card",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 28),
),
Text(
"27 Feb",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Colors.grey,
),
),
],
),
Container(
height: 70,
width: 75,
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: const Color(0xFFFF8B66),
),
child: const Text(
"😝",
textAlign: TextAlign.center,
style: TextStyle(fontSize: 40),
),
),
],
),
);
}
}
master_card.dart
import 'package:flutter/material.dart';
class MesterCard extends StatelessWidget {
String id;
Color color;
String balance;
MesterCard({
super.key,
required this.balance,
required this.color,
required this.id,
});
@override
Widget build(BuildContext context) {
return Stack(
alignment: Alignment.center,
children: [
Container(
margin: const EdgeInsets.only(top: 100, left: 10),
width: MediaQuery.of(context).size.width - 40,
decoration: BoxDecoration(
color: color,
borderRadius: BorderRadius.circular(40),
),
child: Stack(
children: [
// for rectangular box in card
cardBackground(size: 50, pTop: 90, pLeft: 200),
cardBackground(size: 160, pBottom: -50),
Padding(
padding: const EdgeInsets.all(32),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
masterCardLogo(),
Text(
id,
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18,
color: Colors.white,
),
),
],
),
const SizedBox(
height: 80,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
const Text(
"Mastercard",
style: TextStyle(
color: Colors.white,
),
),
Text(
balance,
style: const TextStyle(
fontSize: 24,
color: Colors.white,
),
),
],
),
Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(18),
),
child: const Icon(
Icons.add,
size: 35,
),
),
],
),
],
),
)
],
),
),
Positioned(
top: 0,
child: Image.asset(
"images/jig.png",
width: 140,
),
),
],
);
}
Positioned cardBackground({
double size = 40,
double? pTop,
double? pBottom,
double? pLeft,
double? pRight,
}) =>
Positioned(
left: pLeft,
top: pTop,
bottom: pBottom,
right: pRight,
child: Transform.rotate(
angle: 1,
child: Container(
decoration: BoxDecoration(
color: Colors.white10,
borderRadius: BorderRadius.circular(size / 6),
),
height: size,
width: size,
),
),
);
SizedBox masterCardLogo() {
return SizedBox(
width: 100,
child: Stack(
children: [
Container(
width: 30,
height: 30,
decoration: BoxDecoration(
color: Colors.white70,
borderRadius: BorderRadius.circular(25),
),
),
Positioned(
left: 20,
child: Container(
width: 30,
height: 30,
decoration: BoxDecoration(
color: Colors.white24,
borderRadius: BorderRadius.circular(25),
),
),
),
],
),
);
}
}
transaction_items.dart
import 'package:flutter/material.dart';
class TransactionItems extends StatelessWidget {
VoidCallback onTab;
IconData icon;
Color color;
String remark;
String total;
String time;
String date;
TransactionItems({
super.key,
required this.icon,
required this.onTab,
required this.color,
required this.date,
required this.remark,
required this.time,
required this.total,
});
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 10
),
child: GestureDetector(
onTap: ()=> onTab(),
child: Row(
children: [
Container(
margin: const EdgeInsets.only(right: 18),
padding: const EdgeInsets.all(22),
decoration: BoxDecoration(
color: color.withOpacity(0.12),
borderRadius: BorderRadius.circular(20),
),
child: Icon(
icon,
size: 30,
color: color,
),
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
remark,
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20,
),
),
Text(
time,
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 12,
color: Colors.grey,
),
),
],
),
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
total,
style: const TextStyle(
fontWeight: FontWeight.bold,
color: Colors.green,
fontSize: 22,
),
),
Text(
date,
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 12,
color: Colors.grey,
),
),
],
),
),
],
),
),
);
}
}
/Detail/transaction_item_detail.dart
import 'package:carousel_slider/carousel_slider.dart';
import 'package:flutter/material.dart';
import 'package:fl_chart/fl_chart.dart';
import 'statistics_data.dart';
class TransactionItemDetail extends StatefulWidget {
const TransactionItemDetail({super.key});
@override
State createState() => _TransactionItemDetailState();
}
class _TransactionItemDetailState extends State {
int currentIndex = 0;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.deepPurple,
body: SafeArea(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// for back button
Padding(
padding: const EdgeInsets.only(left: 20),
child: GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: const Icon(
Icons.arrow_back_ios,
color: Colors.white,
),
),
),
// for icon menu
sliderMenu(),
const SizedBox(
height: 40,
),
totalIncomeExpanse(),
const SizedBox(
height: 40,
),
totalLineCharts(),
const SizedBox(
height: 20,
),
// for Statistics
const StatisticsData(),
],
)),
);
}
SizedBox totalLineCharts() {
return SizedBox(
height: 240,
child: LineChart(
LineChartData(
lineTouchData: const LineTouchData(enabled: false),
gridData: const FlGridData(show: false),
borderData: FlBorderData(show: false),
titlesData: FlTitlesData(
rightTitles:
const AxisTitles(sideTitles: SideTitles(showTitles: false)),
topTitles:
const AxisTitles(sideTitles: SideTitles(showTitles: false)),
leftTitles:
const AxisTitles(sideTitles: SideTitles(showTitles: false)),
bottomTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true,
reservedSize: 32,
getTitlesWidget: (double value, TitleMeta meta) {
const style = TextStyle(color: Colors.white60, fontSize: 15);
Widget text;
switch (value.toInt()) {
case 1:
text = const Text('Mon', style: style);
break;
case 2:
text = const Text('Thu', style: style);
break;
case 3:
text = const Text('Wed', style: style);
break;
case 4:
text = const Text('Thr', style: style);
break;
case 5:
text = const Text('Fri', style: style);
break;
case 6:
text = const Text('Sat', style: style);
break;
case 7:
text = const Text(
'Sun',
style: style,
);
break;
default:
text = const Text("");
}
return SideTitleWidget(
axisSide: meta.axisSide,
space: 10,
child: text,
);
},
)),
),
lineBarsData: [
LineChartBarData(
isCurved: true,
curveSmoothness: 0.4,
color: Colors.cyanAccent,
barWidth: 6,
isStrokeCapRound: true,
dotData: const FlDotData(show: false),
belowBarData: BarAreaData(show: false),
spots: const [
FlSpot(1, 3),
FlSpot(2, 1),
FlSpot(3, 5),
FlSpot(4, 2),
FlSpot(5, 5),
FlSpot(6, 6),
FlSpot(7, 9),
],
),
],
maxX: 8,
maxY: 10,
minX: 0,
minY: 0,
),
),
);
}
Padding totalIncomeExpanse() {
return const Padding(
padding: EdgeInsets.symmetric(horizontal: 38),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
children: [
Text(
"Total Income",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20,
color: Colors.white60,
),
),
Text(
"\$2,500",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 40,
color: Colors.white,
),
),
],
),
SizedBox(
height: 45,
child: VerticalDivider(
color: Colors.white54,
),
),
Column(
children: [
Text(
"Total Income",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20,
color: Colors.white60,
),
),
Text(
"\$2,500",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 40,
color: Colors.white,
),
),
],
),
],
),
);
}
CarouselSlider sliderMenu() {
return CarouselSlider(
items: [
crouselItems(
index: 0,
color: Colors.blueAccent,
icon: Icons.flight_takeoff,
),
crouselItems(
index: 1,
color: Colors.orange,
icon: Icons.fastfood,
),
crouselItems(
index: 2,
color: Colors.red,
icon: Icons.man_outlined,
),
],
options: CarouselOptions(
autoPlay: false,
height: 100,
enlargeCenterPage: true,
viewportFraction: 0.3,
initialPage: currentIndex,
onPageChanged: (index, reason) {
setState(() {
currentIndex = index;
});
},
),
);
}
Container crouselItems({
required int index,
required Color color,
required IconData icon,
}) {
Color backGroundColor = index == currentIndex ? color : Colors.transparent;
return Container(
width: 100,
decoration: BoxDecoration(
color: Colors.white54,
borderRadius: BorderRadius.circular(20),
),
child: Container(
decoration: BoxDecoration(
color: backGroundColor,
borderRadius: BorderRadius.circular(20),
),
child: Icon(
icon,
color: backGroundColor == color ? Colors.white : color,
size: 35,
),
),
);
}
}
statistics_data.dart
import 'package:flutter/material.dart';
class StatisticsData extends StatelessWidget {
const StatisticsData({
super.key,
});
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 38, vertical: 10),
child: Column(
children: [
const Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Statistics",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 30,
color: Colors.white,
),
),
RotatedBox(
quarterTurns: 3,
child: Icon(
Icons.tune,
size: 32,
color: Colors.white54,
),
)
],
),
Container(
margin: const EdgeInsets.only(top: 20),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25),
color: Colors.orange,
),
child: Row(
children: [
Container(
margin: const EdgeInsets.all(30),
padding: const EdgeInsets.all(13),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
color: Colors.black12,
),
child: Container(
height: 120,
width: 120,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
color: const Color(0xFFE9AA4E),
),
child: const Center(
child: Text(
"55%",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 28),
),
),
),
),
const Column(
children: [
Text(
"Average Spand",
style: TextStyle(
color: Colors.white54,
),
),
Text(
"\$4,100",
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
SizedBox(
height: 10,
),
Row(
children: [
Icon(
Icons.file_open,
color: Colors.white,
size: 18,
),
SizedBox(
width: 10,
),
Text(
"Report",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
],
)
],
)
],
),
),
],
),
);
}
}
// add completed.