Skip to content

Commit

Permalink
Fixed minor bugs and updated deprecations in Contact us Page
Browse files Browse the repository at this point in the history
  • Loading branch information
TheGuyDangerous committed Oct 22, 2022
1 parent 72a8205 commit 55c34d8
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 162 deletions.
81 changes: 31 additions & 50 deletions lib/Screens/about_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ import 'package:flutter/material.dart';
import 'package:iconsax/iconsax.dart';
import 'package:line_icons/line_icons.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:url_launcher/url_launcher_string.dart';

class AboutPage extends StatefulWidget {
const AboutPage({Key? key}) : super(key: key);
const AboutPage({super.key});

@override
// ignore: library_private_types_in_public_api
_AboutPageState createState() => _AboutPageState();
State<AboutPage> createState() => _AboutPageState();
}

class _AboutPageState extends State<AboutPage> {
Expand Down Expand Up @@ -122,15 +121,11 @@ class _AboutPageState extends State<AboutPage> {
InkWell(
borderRadius: BorderRadius.circular(15.0),
onTap: () async {
if (await canLaunch(
'https://www.linkedin.com/in/sannidhyadubey')) {
await launch(
'https://www.linkedin.com/in/sannidhyadubey',
forceSafariVC: false,
forceWebView: false,
);
const url = 'https://www.linkedin.com/in/sannidhyadubey';
if (await launchUrlString(url)) {
await launchUrlString(url);
} else {
throw 'Could not launch';
throw 'Could not launch $url';
}
},
child: const ListTile(
Expand All @@ -146,14 +141,11 @@ class _AboutPageState extends State<AboutPage> {
InkWell(
borderRadius: BorderRadius.circular(15.0),
onTap: () async {
if (await canLaunch('https://www.linkedin.com/in/roy15')) {
await launch(
'https://www.linkedin.com/in/roy15',
forceSafariVC: false,
forceWebView: false,
);
const url = 'https://www.linkedin.com/in/roy15';
if (await launchUrlString(url)) {
await launchUrlString(url);
} else {
throw 'Could not launch';
throw 'Could not launch $url';
}
},
child: const ListTile(
Expand All @@ -163,21 +155,18 @@ class _AboutPageState extends State<AboutPage> {
child: Icon(Iconsax.user),
),
title: Text('Bishal Roy'),
subtitle: Text('Lead Designer and Co-Lead'),
subtitle: Text('Lead Designer'),
),
),
InkWell(
borderRadius: BorderRadius.circular(15.0),
onTap: () async {
if (await canLaunch(
'https://www.linkedin.com/in/sneha-soni-918224236/')) {
await launch(
'https://www.linkedin.com/in/sneha-soni-918224236/',
forceSafariVC: false,
forceWebView: false,
);
const url =
'https://www.linkedin.com/in/sneha-soni-918224236';
if (await launchUrlString(url)) {
await launchUrlString(url);
} else {
throw 'Could not launch';
throw 'Could not launch $url';
}
},
child: const ListTile(
Expand Down Expand Up @@ -216,12 +205,10 @@ class _AboutPageState extends State<AboutPage> {
InkWell(
borderRadius: BorderRadius.circular(15.0),
onTap: () async {
if (await canLaunch(
'https://www.linkedin.com/in/sannidhyadubey/')) {
await launch(
'https://www.linkedin.com/in/sannidhyadubey/',
forceSafariVC: false,
forceWebView: false,
if (await launchUrlString(
'https://www.linkedin.com/in/sannidhyadubey')) {
await launchUrlString(
'https://www.linkedin.com/in/sannidhyadubey',
);
} else {
throw 'Could not launch';
Expand All @@ -240,12 +227,10 @@ class _AboutPageState extends State<AboutPage> {
InkWell(
borderRadius: BorderRadius.circular(15.0),
onTap: () async {
if (await canLaunch(
'https://github.com/TheGuyDangerous/Aawaaz')) {
await launch(
'https://github.com/TheGuyDangerous/Aawaaz',
forceSafariVC: false,
forceWebView: false,
if (await launchUrlString(
'https://github.com/TheGuyDangerous/Voicerra')) {
await launchUrlString(
'https://github.com/TheGuyDangerous/Voicerra',
);
} else {
throw 'Could not launch';
Expand All @@ -264,12 +249,10 @@ class _AboutPageState extends State<AboutPage> {
InkWell(
borderRadius: BorderRadius.circular(15.0),
onTap: () async {
if (await canLaunch(
'https://github.com/TheGuyDangerous/Aawaaz/issues/new')) {
await launch(
'https://github.com/TheGuyDangerous/Aawaaz/issues/new',
forceSafariVC: false,
forceWebView: false,
if (await launchUrlString(
'https://github.com/TheGuyDangerous/Voicerra/issues/new')) {
await launchUrlString(
'https://github.com/TheGuyDangerous/Voicerra/issues/new',
);
} else {
throw 'Could not launch';
Expand All @@ -288,11 +271,9 @@ class _AboutPageState extends State<AboutPage> {
InkWell(
borderRadius: BorderRadius.circular(15.0),
onTap: () async {
if (await canLaunch('https://paypal.me/GuyDangerous')) {
await launch(
if (await launchUrlString('https://paypal.me/GuyDangerous')) {
await launchUrlString(
'https://paypal.me/GuyDangerous',
forceSafariVC: false,
forceWebView: false,
);
} else {
throw 'Could not launch';
Expand Down
3 changes: 1 addition & 2 deletions lib/Screens/edit_note_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ class AddEditNotePage extends StatefulWidget {
this.note,
}) : super(key: key);
@override
// ignore: library_private_types_in_public_api
_AddEditNotePageState createState() => _AddEditNotePageState();
State<AddEditNotePage> createState() => _AddEditNotePageState();
}

class _AddEditNotePageState extends State<AddEditNotePage> {
Expand Down
32 changes: 17 additions & 15 deletions lib/Screens/note_detail_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class NoteDetailPage extends StatefulWidget {
}) : super(key: key);

@override
_NoteDetailPageState createState() => _NoteDetailPageState();
State<NoteDetailPage> createState() => _NoteDetailPageState();
}

class _NoteDetailPageState extends State<NoteDetailPage> {
Expand All @@ -30,51 +30,52 @@ class _NoteDetailPageState extends State<NoteDetailPage> {
Future refreshNote() async {
setState(() => isLoading = true);

this.note = await NotesDatabase.instance.readNote(widget.noteId);
note = await NotesDatabase.instance.readNote(widget.noteId);

setState(() => isLoading = false);
}

@override
Widget build(BuildContext context) => Scaffold(
backgroundColor: Color(0xffe7ddff),
backgroundColor: const Color(0xfff2f2f2),
appBar: AppBar(
backgroundColor: Color(0xFF2f2554),
backgroundColor: const Color(0xFF2f2554),
centerTitle: true,
actions: [editButton(), deleteButton()],
),
body: isLoading
? Center(child: CircularProgressIndicator())
? const Center(child: CircularProgressIndicator())
: Padding(
padding: EdgeInsets.all(12),
padding: const EdgeInsets.all(12),
child: ListView(
padding: EdgeInsets.symmetric(vertical: 8),
padding: const EdgeInsets.symmetric(vertical: 8),
children: [
Text(
note.title,
style: TextStyle(
style: const TextStyle(
color: Color(0xff263238),
fontSize: 22,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 8),
const SizedBox(height: 8),
Text(
DateFormat.yMMMd().format(note.createdTime),
style: TextStyle(color: Colors.black26),
style: const TextStyle(color: Colors.black26),
),
SizedBox(height: 8),
const SizedBox(height: 8),
Text(
note.description,
style: TextStyle(color: Color(0xff263238), fontSize: 18),
style: const TextStyle(
color: Color(0xff263238), fontSize: 18),
)
],
),
),
);

Widget editButton() => IconButton(
icon: Icon(Icons.edit_outlined),
icon: const Icon(Icons.edit_outlined),
onPressed: () async {
if (isLoading) return;

Expand All @@ -86,11 +87,12 @@ class _NoteDetailPageState extends State<NoteDetailPage> {
});

Widget deleteButton() => IconButton(
icon: Icon(Icons.delete),
icon: const Icon(Icons.delete),
onPressed: () async {
final navigator = Navigator.of(context);
await NotesDatabase.instance.delete(widget.noteId);

Navigator.of(context).pop();
navigator.pop();
},
);
}
2 changes: 1 addition & 1 deletion lib/Screens/notes_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class _NotesPageState extends State<NotesPage> {
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
decoration: const BoxDecoration(
color: Colors.white,
color: Color(0xFFf2f2f2),
borderRadius: BorderRadius.only(
topRight: Radius.circular(40),
topLeft: Radius.circular(40),
Expand Down
60 changes: 21 additions & 39 deletions lib/Screens/transcribe_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,23 @@ import 'dart:async';
import 'package:iconsax/iconsax.dart';
import 'package:file_picker/file_picker.dart';

class Transcriber extends StatelessWidget {
const Transcriber({super.key});

// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Transcribe Page',
theme: ThemeData(
primarySwatch: Colors.blue,
fontFamily: 'poppins',
),
home: const TranscribePage(
title: 'Transcribe',
),
);
}
}

class TranscribePage extends StatefulWidget {
final String title;

const TranscribePage({super.key, required this.title});

@override
// ignore: library_private_types_in_public_api
_TranscribePageState createState() => _TranscribePageState();
State<TranscribePage> createState() => _TranscribePageState();
}

class _TranscribePageState extends State<TranscribePage> {
// ignore: non_constant_identifier_names
bool is_Transcribing = false;
bool isTranscribing = false;
String content = '';
File? file;

void transcribe() async {
setState(() {
is_Transcribing = true;
isTranscribing = true;
});
final serviceAccount = ServiceAccount.fromString(
(await rootBundle.loadString('assets/cloud.json')));
Expand All @@ -68,7 +46,7 @@ class _TranscribePageState extends State<TranscribePage> {
});
}).whenComplete(() {
setState(() {
is_Transcribing = false;
isTranscribing = false;
});
});
}
Expand Down Expand Up @@ -114,7 +92,7 @@ class _TranscribePageState extends State<TranscribePage> {
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
decoration: const BoxDecoration(
color: Colors.white,
color: Color(0xFFf2f2f2),
borderRadius: BorderRadius.only(
topRight: Radius.circular(50),
topLeft: Radius.circular(50),
Expand All @@ -125,32 +103,36 @@ class _TranscribePageState extends State<TranscribePage> {
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
const SizedBox(
height: 70,
height: 50,
),
Container(
height: 200,
width: 300,
width: 350,
decoration: BoxDecoration(
border: Border.all(color: Colors.black),
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
padding: const EdgeInsets.all(5.0),
padding: const EdgeInsets.all(20.0),
child: content == ''
? const Text(
'Your text will appear here',
style: TextStyle(color: Colors.grey),
? const Center(
child: Text(
'Your text will appear here',
style: TextStyle(color: Colors.grey),
),
)
: Text(
content,
style: const TextStyle(fontSize: 20),
: Center(
child: Text(
content,
style: const TextStyle(fontSize: 20),
),
),
),
const SizedBox(
height: 10,
),
//Transcribe button
Container(
child: is_Transcribing
child: isTranscribing
? const Padding(
padding: EdgeInsets.symmetric(
horizontal: 150, vertical: 70),
Expand All @@ -168,7 +150,7 @@ class _TranscribePageState extends State<TranscribePage> {
: Padding(
padding: const EdgeInsets.all(8.0),
child: TextButton(
onPressed: is_Transcribing ? () {} : transcribe,
onPressed: isTranscribing ? () {} : transcribe,
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 25, horizontal: 15),
Expand Down
Loading

0 comments on commit 55c34d8

Please sign in to comment.