Skip to content

Commit 8411e51

Browse files
authored
final flutter app for levelup23 (#603)
* final flutter app for levelup23 Signed-off-by: Mark Nelson <[email protected]>
1 parent d0f6780 commit 8411e51

File tree

16 files changed

+274
-56
lines changed

16 files changed

+274
-56
lines changed

cloudbank-v2/flutter-app/.placeholder

Whitespace-only changes.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright (c) 2023, Oracle and/or its affiliates.
2+
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
3+
4+
import 'credentials.dart';
5+
6+
class AccountDetailArguments {
7+
final Credentials creds;
8+
final int accountId;
9+
10+
AccountDetailArguments(this.creds, this.accountId);
11+
}

cloudbank-v2/flutter-app/lib/components/appbar.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Copyright (c) 2023, Oracle and/or its affiliates.
2+
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
3+
14
import 'package:flutter/material.dart';
25

36
class CloudBankAppBar extends StatefulWidget implements PreferredSizeWidget {

cloudbank-v2/flutter-app/lib/components/bottombuttonbar.dart

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Copyright (c) 2023, Oracle and/or its affiliates.
2+
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
3+
14
import 'package:flutter/material.dart';
25
import 'package:go_router/go_router.dart';
36

@@ -38,20 +41,6 @@ class BottomButtonBar extends StatelessWidget {
3841
],
3942
),
4043
const SizedBox(height: 10),
41-
Row(
42-
children: [
43-
ElevatedButton(
44-
onPressed: () => GoRouter.of(context).go('/resttest'),
45-
style: ElevatedButton.styleFrom(
46-
backgroundColor: Colors.amber[400],
47-
),
48-
child: const Padding(
49-
padding: EdgeInsets.all(16),
50-
child: Text('REST Test'),
51-
),
52-
),
53-
],
54-
),
5544
],
5645
);
5746
}

cloudbank-v2/flutter-app/lib/components/credentials.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Copyright (c) 2023, Oracle and/or its affiliates.
2+
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
3+
14
class Credentials {
25
final String username;
36
final String email;

cloudbank-v2/flutter-app/lib/components/myaccounts.dart

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1+
// Copyright (c) 2023, Oracle and/or its affiliates.
2+
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
3+
4+
import 'dart:ffi';
5+
16
import 'package:flutter/material.dart';
27
import 'package:loginapp/components/credentials.dart';
38
import 'package:loginapp/screens/accountdetail.dart';
49
import 'package:http/http.dart' as http;
510
import 'dart:convert';
11+
import 'package:intl/intl.dart';
12+
13+
import 'accountdetailarguments.dart';
14+
15+
final formatCurrency = new NumberFormat.simpleCurrency();
616

717
class Accounts {
818
final List<dynamic> accounts;
@@ -87,12 +97,14 @@ class _MyAccountsState extends State<MyAccounts> {
8797
children: [
8898
Text(data[index]['accountName'].toString()),
8999
Text(
90-
data[index]['accountBalance'].toString(),
100+
formatCurrency
101+
.format(data[index]['accountBalance']),
91102
textScaleFactor: 1.5,
92103
),
93104
],
94105
),
95-
subtitle: Text(data[index]['accountId'].toString()),
106+
subtitle:
107+
Text("CB ACCT-${data[index]['accountId']}"),
96108
),
97109
Row(
98110
mainAxisAlignment: MainAxisAlignment.end,
@@ -103,12 +115,11 @@ class _MyAccountsState extends State<MyAccounts> {
103115
Navigator.push(
104116
context,
105117
MaterialPageRoute(
106-
builder: (context) =>
107-
const AccountDetail(),
108-
// Pass the arguments as part of the RouteSettings. The
109-
// DetailScreen reads the arguments from these settings.
110-
settings: RouteSettings(
111-
arguments: widget.creds,
118+
builder: (context) => AccountDetail(
119+
args: AccountDetailArguments(
120+
widget.creds,
121+
data[index]['accountId'],
122+
),
112123
),
113124
),
114125
);

cloudbank-v2/flutter-app/lib/components/mycreditcards.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Copyright (c) 2023, Oracle and/or its affiliates.
2+
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
3+
14
import 'package:flutter/material.dart';
25
import 'package:go_router/go_router.dart';
36

cloudbank-v2/flutter-app/lib/main.dart

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Copyright (c) 2023, Oracle and/or its affiliates.
2+
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
3+
14
import 'dart:io';
25

36
import 'package:flutter/material.dart';
@@ -11,7 +14,7 @@ import 'package:loginapp/screens/transfer.dart';
1114
import 'package:parse_server_sdk_flutter/parse_server_sdk.dart';
1215
import 'package:go_router/go_router.dart';
1316

14-
const String backendUrl = 'http://129.158.244.40';
17+
const String backendUrl = 'http://1.2.3.4';
1518

1619
// GoRouter configuration
1720
final _router = GoRouter(
@@ -40,10 +43,6 @@ final _router = GoRouter(
4043
path: '/transfer',
4144
builder: (context, state) => const Transfer(),
4245
),
43-
GoRoute(
44-
path: '/accountdetail',
45-
builder: (context, state) => const AccountDetail(),
46-
),
4746
GoRoute(
4847
path: '/applycc',
4948
builder: (context, state) => const ApplyForCreditCard(),
@@ -52,25 +51,19 @@ final _router = GoRouter(
5251
);
5352

5453
void main() async {
55-
// Parse code
54+
// Initialize Parse
5655
WidgetsFlutterBinding.ensureInitialized();
5756
const keyApplicationId = 'APPLICATION_ID';
58-
// WebLogicOnDocker Old Install
59-
const keyParseServerUrl = 'http://129.80.94.27/parse';
60-
// MaaCloud New Install Not Working Yet, Parse Server Keep crashing
61-
// const keyParseServerUrl = 'http://129.159.115.55/parse';
57+
const keyParseServerUrl = '$backendUrl/parse';
6258

6359
var response = await Parse().initialize(keyApplicationId, keyParseServerUrl);
6460
if (!response.hasParseBeenInitialized()) {
65-
// https://stackoverflow.com/questions/45109557/flutter-how-to-programmatically-exit-the-app
6661
exit(0);
6762
}
6863
var firstObject = ParseObject('FirstClass')
69-
..set('message', 'LoginApp is Connected 2');
64+
..set('message', 'LoginApp is Connected 3');
7065
await firstObject.save();
71-
72-
print('done');
73-
// Parse code done
66+
// Parse code done
7467

7568
runApp(const MyApp());
7669
}

0 commit comments

Comments
 (0)