Skip to content

Commit 96ee366

Browse files
committed
clearly refactoring code base to accommodate cloud notes coming soon
1 parent b2b1858 commit 96ee366

File tree

4 files changed

+156
-301
lines changed

4 files changed

+156
-301
lines changed

lib/app/screens/home.dart

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import 'dart:io';
33
import 'package:flutter/cupertino.dart';
44
import 'package:flutter/material.dart';
55
import 'package:flutter/services.dart';
6-
import 'package:flutter_paystack_payment/flutter_paystack_payment.dart';
76
import 'package:flutter_screenutil/flutter_screenutil.dart';
87
import 'package:hive/hive.dart';
98
import 'package:hive_flutter/hive_flutter.dart';
@@ -30,48 +29,34 @@ class HomeScreen extends StatefulWidget {
3029

3130
class _HomeScreenState extends State<HomeScreen> {
3231
Box<NoteModel>? storeData;
33-
final plugin = PaystackPayment();
3432

3533
@override
3634
void initState() {
3735
super.initState();
3836
storeData = Hive.box<NoteModel>(noteBox);
3937
initPlatformState();
4038
_checkVersion();
41-
plugin.initialize(publicKey: payStackPubKey);
4239
}
4340

4441
void _checkVersion() async {
4542
final newVersion = NewVersion(
46-
androidId: 'com.viewus.v_notes',
43+
androidId: androidID,
4744
);
4845
final status = await newVersion.getVersionStatus();
4946
if (status!.canUpdate) {
50-
newVersion.showUpdateDialog(
51-
context: context,
52-
versionStatus: status,
53-
dialogTitle: 'Update V Notes',
54-
dialogText: 'There is a new update for V Notes, '
55-
'would you like to update to check up '
56-
'what we have improved about the app',
57-
updateButtonText: 'Update now',
58-
dismissButtonText: 'Maybe Later',
59-
);
47+
if(mounted) {
48+
newVersion.showUpdateDialog(
49+
context: context,
50+
versionStatus: status,
51+
dialogTitle: dialogTitle,
52+
dialogText: dialogText,
53+
updateButtonText: 'Update now',
54+
dismissButtonText: 'Maybe Later',
55+
);
56+
}
6057
}
6158
}
6259

63-
Future startPayment() async {
64-
Charge charge = Charge()
65-
..amount = 10000
66-
..reference = 'dafsddafdfas'
67-
..email = 'customer@email.com';
68-
CheckoutResponse response = await plugin.checkout(
69-
context,
70-
method: CheckoutMethod.card, // Defaults to CheckoutMethod.selectable
71-
charge: charge,
72-
);
73-
}
74-
7560
static const String oneSignalAppId = 'e41ee34c-a2e9-4345-aa95-078b223419b3';
7661

7762
@override
@@ -204,7 +189,7 @@ class _HomeScreenState extends State<HomeScreen> {
204189
: defaultWhite,
205190
),
206191
Text(
207-
'Could Note',
192+
'Cloud Note',
208193
style: TextStyle(
209194
fontSize: 20.sp,
210195
fontWeight: FontWeight.bold,

lib/const_values.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ String apiUrl = dotenv.env['API_URL'].toString();
88
String payStackPubKey = dotenv.env['PAYSTACK_PUB_KEY'].toString();
99
String payStackSecKey = dotenv.env['PAYSTACK_SEC_KEY'].toString();
1010

11+
const String androidID = 'com.viewus.v_notes';
12+
const String dialogTitle = 'Update V Notes';
13+
const String dialogText = 'There is a new update for V Notes, '
14+
'would you like to update to check up '
15+
'what we have improved about the app';
16+
1117
const Color backColor = Color.fromRGBO(224, 211, 175, 1);
1218

1319
const Color appbarColor = Color.fromRGBO(48, 48, 48, 1);

0 commit comments

Comments
 (0)