Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Apr 24, 2024
2 parents 44957c9 + bd75043 commit 43092d8
Show file tree
Hide file tree
Showing 8 changed files with 226 additions and 198 deletions.
1 change: 1 addition & 0 deletions flutter_bank_ui/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
// import 'package:online_bank/pages/home_page.dart';
import 'pages/login_page.dart';

void main() {
Expand Down
6 changes: 3 additions & 3 deletions flutter_bank_ui/lib/pages/about_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class _AboutPageState extends State<AboutPage> {

MyRead(
content:
'„Пропър Инвест Банк“ АД е учредена на 10 октомври 2022 година Акционерният капитал на Банката възлиза на 13 000 000 лева и е разпределен на 13 безналични, поименни акции, всяка с номинална стойност 1 000 000.00 лева и право на глас.',
'„Пропър Инвест Банк“ АД е учредена на 10 октомври 2022 година Акционерният капитал на Банката възлиза на 13 000 лева и е разпределен на 13 безналични, поименни акции, всяка с номинална стойност 1 000.00 лева и право на глас.',
trimLines: 7,
align: TextAlign.justify,
size: 16,
Expand All @@ -62,15 +62,15 @@ class _AboutPageState extends State<AboutPage> {

MyRead(
content:
'Ние ще ви помогнем: Да увеличите средствата чрез депозит; Да увеличите капитала си чрез набирателна сметка; Да плащате и разполагате със средства навсякъде, лесно и удобно с банкова платежна карта',
'Ние ще ви помогнем: Да увеличите средствата чрез депозит; Да увеличите капитала си чрез набирателна сметка; Да плащате и разполагате със средства навсякъде, лесно и удобно с банкова платежна карта; Да закупите мечтания си дом;',
trimLines: 1,
align: TextAlign.justify,
size: 16,
weight: FontWeight.normal),

MyRead(
content:
'Банкови продукти и услуги: Банкови сметки-(Разплащателна сметка, Набирателна сметка, Депозитна сметка, Спестовна сметка); Вложения-(Влогове и депозити); Банкови платежни карти-(Дебитни и кредитни карти); Банкови платежни документи;',
'Банкови продукти и услуги: Банкови сметки-(Разплащателна сметка, Набирателна сметка, Депозитна сметка, Спестовна сметка); Ипотечни кредити; Вложения-(Влогове и депозити); Банкови платежни карти-(Дебитни и кредитни карти); Банкови платежни документи;',
trimLines: 1,
align: TextAlign.justify,
size: 16,
Expand Down
45 changes: 7 additions & 38 deletions flutter_bank_ui/lib/pages/home_page.dart
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
// ignore_for_file: prefer_const_literals_to_create_immutables, prefer_const_constructors, sized_box_for_whitespace

import 'package:flutter/material.dart';
import 'pay_page.dart';
import 'statistics_page.dart';
import 'transaction_page.dart';
import '../utill/app_bar.dart';
import '../utill/bottom_app_bar.dart';
import '../utill/my_button.dart';
import '../utill/my_card.dart';
import '../utill/my_list_tile.dart';
import 'package:smooth_page_indicator/smooth_page_indicator.dart';
import 'package:online_bank/pages/send_page.dart';

import 'bills_page.dart';

class HomePage extends StatefulWidget {
const HomePage({super.key});

Expand Down Expand Up @@ -85,46 +81,19 @@ class _HomePageState extends State<HomePage> {

SizedBox(height: 20),

// 3 buttons ->send + pay + bills
// column -> stats + transaction
Padding(
padding: const EdgeInsets.symmetric(horizontal: 25.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
padding: const EdgeInsets.all(25.0),
child: Column(
children: [
// send button
MyButton(
//Send
MyListTile(
iconImagePath: 'lib/icons/send.png',
buttonText: 'Прати',
tileTitle: 'Преводи',
tileSubtitle: 'Прати по сметка',
page: SendPage(context: context),
is_paying: false,
),

//pay button
MyButton(
iconImagePath: 'lib/icons/credit-card.png',
buttonText: 'Плати',
page: PayPage(context: context),
is_paying: true,
),

//bills button
MyButton(
iconImagePath: 'lib/icons/bill.png',
buttonText: 'Сметки',
page: BillsPage(context: context),
is_paying: false,
),
],
),
),

SizedBox(height: 20),

// column -> stats + transaction
Padding(
padding: const EdgeInsets.all(25.0),
child: Column(
children: [
//Stats
MyListTile(
iconImagePath: 'lib/icons/statistics.png',
Expand Down
34 changes: 25 additions & 9 deletions flutter_bank_ui/lib/pages/login_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';
import 'home_page.dart'; // Adjust if needed
// import '../utill/session_manager.dart'; // Import your session management class

class LoginPage extends StatefulWidget {
@override
Expand All @@ -12,6 +13,8 @@ class _LoginPageState extends State<LoginPage> {
final TextEditingController _usernameController = TextEditingController();
final TextEditingController _passwordController = TextEditingController();

final String basicAuth = 'Basic ' + base64Encode(utf8.encode('admin:admin'));

Future<void> _login() async {
final username = _usernameController.text.trim();
final password = _passwordController.text.trim();
Expand All @@ -24,23 +27,36 @@ class _LoginPageState extends State<LoginPage> {
return;
}

// Example backend authentication (adjust endpoint and request parameters as needed)
// Example backend authentication
final response = await http.post(
Uri.parse('https://example.com/api/login'), // Update with your endpoint
headers: {'Content-Type': 'application/json'},
Uri.parse(
'http://113.30.151.151:8080/services/ts/dirigible-bank-server-api/user.ts/login'), // Adjust endpoint
headers: {'Content-Type': 'application/json', 'Authorization': basicAuth},
body: json.encode({
'username': username,
'password': password,
'Username': username,
'Password': password,
}),
);

if (response.statusCode == 200) {
// Successful login, navigate to the Home Page
// Parse the session data from the response
// var sessionData = jsonDecode(response.body);

// Store the session data
// await SessionManager.setSessionId(
// sessionData['sessionId']); // Store session ID
// await SessionManager.setUserId(sessionData['userId']); // Store user ID

// Navigate to the Home Page
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => HomePage()),
MaterialPageRoute(
builder: (context) =>
HomePage(), // Corrected extra positional argument
),
);
} else {
print(response.statusCode);
// Login failed
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text("Login failed. Please try again.")),
Expand All @@ -53,7 +69,7 @@ class _LoginPageState extends State<LoginPage> {
return Scaffold(
appBar: AppBar(title: Text("Login")),
body: Padding(
padding: const EdgeInsets.all(16.0),
padding: const EdgeInsets.all(16), // Ensure padding is provided
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expand All @@ -62,7 +78,7 @@ class _LoginPageState extends State<LoginPage> {
decoration: InputDecoration(labelText: "Username"),
),
TextField(
controller: _passwordController, // Corrected variable name
controller: _passwordController,
obscureText: true,
decoration: InputDecoration(labelText: "Password"),
),
Expand Down
74 changes: 36 additions & 38 deletions flutter_bank_ui/lib/utill/app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,54 @@
import 'package:flutter/material.dart';

class MyAppBar extends StatelessWidget {

final String first_name;
final String second_name;

const MyAppBar({
super.key,
required this.first_name,
required this.second_name,
});
});

@override
Widget build(BuildContext context) {
return Align(
alignment: Alignment.topLeft,
child: Container(
width: 600,
decoration: BoxDecoration(
color: Colors.blue.shade800,
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(95),
)
),
child: Padding(
padding: const EdgeInsets.only(left: 30.0, top: 10.0, bottom: 10.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Text(
first_name,
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
Text(
' ' + second_name,
style: TextStyle(
fontSize: 28,
color: Colors.white,
),
),
],
alignment: Alignment.topLeft,
child: Container(
width: 600,
decoration: BoxDecoration(
color: Colors.blue.shade800,
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(95),
)),
child: Padding(
padding: const EdgeInsets.only(left: 30.0, top: 10.0, bottom: 10.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Text(
first_name,
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
Text(
' ' + second_name,
style: TextStyle(
fontSize: 28,
color: Colors.white,
),
],
),
],
),
),
);
],
),
),
),
);
}
}
}
Loading

0 comments on commit 43092d8

Please sign in to comment.