Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright (c) 2023, Oracle and/or its affiliates.
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/

import 'credentials.dart';

class AccountDetailArguments {
final Credentials creds;
final int accountId;

AccountDetailArguments(this.creds, this.accountId);
}
3 changes: 3 additions & 0 deletions cloudbank-v2/flutter-app/lib/components/appbar.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2023, Oracle and/or its affiliates.
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/

import 'package:flutter/material.dart';

class CloudBankAppBar extends StatefulWidget implements PreferredSizeWidget {
Expand Down
17 changes: 3 additions & 14 deletions cloudbank-v2/flutter-app/lib/components/bottombuttonbar.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2023, Oracle and/or its affiliates.
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/

import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

Expand Down Expand Up @@ -38,20 +41,6 @@ class BottomButtonBar extends StatelessWidget {
],
),
const SizedBox(height: 10),
Row(
children: [
ElevatedButton(
onPressed: () => GoRouter.of(context).go('/resttest'),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.amber[400],
),
child: const Padding(
padding: EdgeInsets.all(16),
child: Text('REST Test'),
),
),
],
),
],
);
}
Expand Down
3 changes: 3 additions & 0 deletions cloudbank-v2/flutter-app/lib/components/credentials.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2023, Oracle and/or its affiliates.
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/

class Credentials {
final String username;
final String email;
Expand Down
27 changes: 19 additions & 8 deletions cloudbank-v2/flutter-app/lib/components/myaccounts.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
// Copyright (c) 2023, Oracle and/or its affiliates.
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/

import 'dart:ffi';

import 'package:flutter/material.dart';
import 'package:loginapp/components/credentials.dart';
import 'package:loginapp/screens/accountdetail.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';
import 'package:intl/intl.dart';

import 'accountdetailarguments.dart';

final formatCurrency = new NumberFormat.simpleCurrency();

class Accounts {
final List<dynamic> accounts;
Expand Down Expand Up @@ -87,12 +97,14 @@ class _MyAccountsState extends State<MyAccounts> {
children: [
Text(data[index]['accountName'].toString()),
Text(
data[index]['accountBalance'].toString(),
formatCurrency
.format(data[index]['accountBalance']),
textScaleFactor: 1.5,
),
],
),
subtitle: Text(data[index]['accountId'].toString()),
subtitle:
Text("CB ACCT-${data[index]['accountId']}"),
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
Expand All @@ -103,12 +115,11 @@ class _MyAccountsState extends State<MyAccounts> {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
const AccountDetail(),
// Pass the arguments as part of the RouteSettings. The
// DetailScreen reads the arguments from these settings.
settings: RouteSettings(
arguments: widget.creds,
builder: (context) => AccountDetail(
args: AccountDetailArguments(
widget.creds,
data[index]['accountId'],
),
),
),
);
Expand Down
3 changes: 3 additions & 0 deletions cloudbank-v2/flutter-app/lib/components/mycreditcards.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2023, Oracle and/or its affiliates.
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/

import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

Expand Down
23 changes: 8 additions & 15 deletions cloudbank-v2/flutter-app/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2023, Oracle and/or its affiliates.
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/

import 'dart:io';

import 'package:flutter/material.dart';
Expand All @@ -11,7 +14,7 @@ import 'package:loginapp/screens/transfer.dart';
import 'package:parse_server_sdk_flutter/parse_server_sdk.dart';
import 'package:go_router/go_router.dart';

const String backendUrl = 'http://129.158.244.40';
const String backendUrl = 'http://1.2.3.4';

// GoRouter configuration
final _router = GoRouter(
Expand Down Expand Up @@ -40,10 +43,6 @@ final _router = GoRouter(
path: '/transfer',
builder: (context, state) => const Transfer(),
),
GoRoute(
path: '/accountdetail',
builder: (context, state) => const AccountDetail(),
),
GoRoute(
path: '/applycc',
builder: (context, state) => const ApplyForCreditCard(),
Expand All @@ -52,25 +51,19 @@ final _router = GoRouter(
);

void main() async {
// Parse code
// Initialize Parse
WidgetsFlutterBinding.ensureInitialized();
const keyApplicationId = 'APPLICATION_ID';
// WebLogicOnDocker Old Install
const keyParseServerUrl = 'http://129.80.94.27/parse';
// MaaCloud New Install Not Working Yet, Parse Server Keep crashing
// const keyParseServerUrl = 'http://129.159.115.55/parse';
const keyParseServerUrl = '$backendUrl/parse';

var response = await Parse().initialize(keyApplicationId, keyParseServerUrl);
if (!response.hasParseBeenInitialized()) {
// https://stackoverflow.com/questions/45109557/flutter-how-to-programmatically-exit-the-app
exit(0);
}
var firstObject = ParseObject('FirstClass')
..set('message', 'LoginApp is Connected 2');
..set('message', 'LoginApp is Connected 3');
await firstObject.save();

print('done');
// Parse code done
// Parse code done

runApp(const MyApp());
}
Expand Down
Loading