Skip to content

Commit

Permalink
clearly refactoring code base to accommodate cloud notes coming soon
Browse files Browse the repository at this point in the history
  • Loading branch information
quiet-programmer committed May 23, 2023
1 parent b2b1858 commit 96ee366
Show file tree
Hide file tree
Showing 4 changed files with 156 additions and 301 deletions.
39 changes: 12 additions & 27 deletions lib/app/screens/home.dart
Expand Up @@ -3,7 +3,6 @@ import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_paystack_payment/flutter_paystack_payment.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:hive/hive.dart';
import 'package:hive_flutter/hive_flutter.dart';
Expand All @@ -30,48 +29,34 @@ class HomeScreen extends StatefulWidget {

class _HomeScreenState extends State<HomeScreen> {
Box<NoteModel>? storeData;
final plugin = PaystackPayment();

@override
void initState() {
super.initState();
storeData = Hive.box<NoteModel>(noteBox);
initPlatformState();
_checkVersion();
plugin.initialize(publicKey: payStackPubKey);
}

void _checkVersion() async {
final newVersion = NewVersion(
androidId: 'com.viewus.v_notes',
androidId: androidID,
);
final status = await newVersion.getVersionStatus();
if (status!.canUpdate) {
newVersion.showUpdateDialog(
context: context,
versionStatus: status,
dialogTitle: 'Update V Notes',
dialogText: 'There is a new update for V Notes, '
'would you like to update to check up '
'what we have improved about the app',
updateButtonText: 'Update now',
dismissButtonText: 'Maybe Later',
);
if(mounted) {
newVersion.showUpdateDialog(
context: context,
versionStatus: status,
dialogTitle: dialogTitle,
dialogText: dialogText,
updateButtonText: 'Update now',
dismissButtonText: 'Maybe Later',
);
}
}
}

Future startPayment() async {
Charge charge = Charge()
..amount = 10000
..reference = 'dafsddafdfas'
..email = 'customer@email.com';
CheckoutResponse response = await plugin.checkout(
context,
method: CheckoutMethod.card, // Defaults to CheckoutMethod.selectable
charge: charge,
);
}

static const String oneSignalAppId = 'e41ee34c-a2e9-4345-aa95-078b223419b3';

@override
Expand Down Expand Up @@ -204,7 +189,7 @@ class _HomeScreenState extends State<HomeScreen> {
: defaultWhite,
),
Text(
'Could Note',
'Cloud Note',
style: TextStyle(
fontSize: 20.sp,
fontWeight: FontWeight.bold,
Expand Down
6 changes: 6 additions & 0 deletions lib/const_values.dart
Expand Up @@ -8,6 +8,12 @@ String apiUrl = dotenv.env['API_URL'].toString();
String payStackPubKey = dotenv.env['PAYSTACK_PUB_KEY'].toString();
String payStackSecKey = dotenv.env['PAYSTACK_SEC_KEY'].toString();

const String androidID = 'com.viewus.v_notes';
const String dialogTitle = 'Update V Notes';
const String dialogText = 'There is a new update for V Notes, '
'would you like to update to check up '
'what we have improved about the app';

const Color backColor = Color.fromRGBO(224, 211, 175, 1);

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

0 comments on commit 96ee366

Please sign in to comment.