Skip to content

Commit

Permalink
Clean up & optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
MoazSalem committed Aug 22, 2023
1 parent c7e61c0 commit 99af76a
Show file tree
Hide file tree
Showing 15 changed files with 436 additions and 495 deletions.
473 changes: 205 additions & 268 deletions lib/Cubit/notes_cubit.dart

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/Data/pages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:notes/Screens/SideBar/home.dart';
import 'package:notes/Screens/SideBar/info.dart';
import 'package:notes/Screens/SideBar/notes.dart';
import 'package:notes/Screens/SideBar/settings.dart';
import 'package:notes/Screens/SideBar/voice_notes.dart';
import 'package:notes/Screens/SideBar/voice.dart';

List<Builder> getPages(B) {
return [
Expand Down
10 changes: 5 additions & 5 deletions lib/Screens/Actions/create_note.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class _CreateNoteState extends State<CreateNote> {
flex: C.isTablet ? 8 : 4,
child: ListView(children: [
Padding(
padding: C.lang == 'en'
padding: C.settings["lang"] == 'en'
? EdgeInsets.only(left: C.isTablet ? 60 : 20)
: EdgeInsets.only(right: C.isTablet ? 60 : 20),
child: ValueListenableBuilder<TextDirection>(
Expand Down Expand Up @@ -163,7 +163,7 @@ class _CreateNoteState extends State<CreateNote> {
height: 10,
),
Padding(
padding: C.lang == 'en'
padding: C.settings["lang"] == 'en'
? EdgeInsets.only(left: C.isTablet ? 60 : 20)
: EdgeInsets.only(right: C.isTablet ? 60 : 20),
child: ValueListenableBuilder<TextDirection>(
Expand Down Expand Up @@ -204,7 +204,7 @@ class _CreateNoteState extends State<CreateNote> {
GestureDetector(
onTap: () {
textColor = textColor == 0 ? 1 : 0;
C.onColorChanged();
C.onChanged();
},
child: Padding(
padding: const EdgeInsets.all(6.0),
Expand Down Expand Up @@ -276,7 +276,7 @@ class _CreateNoteState extends State<CreateNote> {
GestureDetector(
onTap: () {
chosenIndex = index;
C.onColorChanged();
C.onChanged();
},
child: Padding(
padding: const EdgeInsets.all(6.0),
Expand All @@ -301,7 +301,7 @@ class _CreateNoteState extends State<CreateNote> {
: GestureDetector(
onTap: () {
chosenIndex = index;
C.onColorChanged();
C.onChanged();
},
child: Padding(
padding: const EdgeInsets.all(6.0),
Expand Down
16 changes: 8 additions & 8 deletions lib/Screens/Actions/create_voice.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class _CreateVoiceState extends State<CreateVoice> {
? null
: C.deleteFile("${C.appDir.path}/Voice/$name.m4a");
Navigator.pop(context);
C.onRecord();
C.onChanged();
},
child: CircleAvatar(
backgroundColor: textColor == 0 ? Colors.white54 : Colors.black54,
Expand Down Expand Up @@ -210,7 +210,7 @@ class _CreateVoiceState extends State<CreateVoice> {
await record.resume();
stopWatchTimer.onStartTimer();
isPaused = false;
C.onRecord();
C.onChanged();
},
icon: Icon(
Icons.play_arrow,
Expand All @@ -225,7 +225,7 @@ class _CreateVoiceState extends State<CreateVoice> {
await record.pause();
stopWatchTimer.onStopTimer();
isPaused = true;
C.onRecord();
C.onChanged();
},
icon: Icon(
Icons.pause,
Expand Down Expand Up @@ -256,7 +256,7 @@ class _CreateVoiceState extends State<CreateVoice> {
// Start recording
isRecording = true;
isPaused = false;
C.onRecord();
C.onChanged();
await record.start(
path: "${C.appDir.path}/Voice/$name.m4a",
encoder: AudioEncoder.aacLc, // by default
Expand All @@ -283,7 +283,7 @@ class _CreateVoiceState extends State<CreateVoice> {
await record.stop();
isRecording = false;
isPaused = false;
C.onRecord();
C.onChanged();
},
icon: Icon(
Icons.stop_circle,
Expand Down Expand Up @@ -314,7 +314,7 @@ class _CreateVoiceState extends State<CreateVoice> {
GestureDetector(
onTap: () {
textColor = textColor == 0 ? 1 : 0;
C.onColorChanged();
C.onChanged();
},
child: Padding(
padding: const EdgeInsets.all(6.0),
Expand Down Expand Up @@ -386,7 +386,7 @@ class _CreateVoiceState extends State<CreateVoice> {
GestureDetector(
onTap: () {
chosenIndex = index;
C.onColorChanged();
C.onChanged();
},
child: Padding(
padding: const EdgeInsets.all(6.0),
Expand All @@ -411,7 +411,7 @@ class _CreateVoiceState extends State<CreateVoice> {
: GestureDetector(
onTap: () {
chosenIndex = index;
C.onColorChanged();
C.onChanged();
},
child: Padding(
padding: const EdgeInsets.all(6.0),
Expand Down
14 changes: 7 additions & 7 deletions lib/Screens/Actions/edit_note.dart
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class _EditNoteState extends State<EditNote> {
child: ListView(children: [
Padding(
padding: isEditing
? C.lang == 'en'
? C.settings["lang"] == 'en'
? EdgeInsets.only(left: C.isTablet ? 60 : 20)
: EdgeInsets.only(right: C.isTablet ? 60 : 20)
: EdgeInsets.symmetric(horizontal: C.isTablet ? 60 : 20),
Expand All @@ -183,7 +183,7 @@ class _EditNoteState extends State<EditNote> {
if (dir != value) _titleDir.value = dir;
}
},
onSaved: C.onViewChanged(),
onSaved: C.onChanged(),
textAlign: TextAlign.center,
maxLines: 2,
cursorColor: textColor == 0 ? Colors.white : Colors.black,
Expand All @@ -207,7 +207,7 @@ class _EditNoteState extends State<EditNote> {
),
Padding(
padding: isEditing
? C.lang == 'en'
? C.settings["lang"] == 'en'
? EdgeInsets.only(left: C.isTablet ? 60 : 20)
: EdgeInsets.only(right: C.isTablet ? 60 : 20)
: EdgeInsets.symmetric(horizontal: C.isTablet ? 60 : 20),
Expand All @@ -221,7 +221,7 @@ class _EditNoteState extends State<EditNote> {
if (dir != value) _contentDir.value = dir;
}
},
onSaved: C.onSearch(),
onSaved: C.onChanged(),
cursorColor: textColor == 0 ? Colors.white : Colors.black,
controller: contentC,
readOnly: isEditing ? false : true,
Expand Down Expand Up @@ -251,7 +251,7 @@ class _EditNoteState extends State<EditNote> {
GestureDetector(
onTap: () {
textColor = textColor == 0 ? 1 : 0;
C.onColorChanged();
C.onChanged();
},
child: Padding(
padding: const EdgeInsets.all(6.0),
Expand Down Expand Up @@ -326,7 +326,7 @@ class _EditNoteState extends State<EditNote> {
GestureDetector(
onTap: () {
bIndex = index2;
C.onColorChanged();
C.onChanged();
},
child: Padding(
padding: const EdgeInsets.all(6.0),
Expand All @@ -351,7 +351,7 @@ class _EditNoteState extends State<EditNote> {
: GestureDetector(
onTap: () {
bIndex = index2;
C.onColorChanged();
C.onChanged();
},
child: Padding(
padding: const EdgeInsets.all(6.0),
Expand Down
8 changes: 4 additions & 4 deletions lib/Screens/Actions/edit_voice.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class _EditVoiceState extends State<EditVoice> {
Padding(
padding: EdgeInsets.symmetric(horizontal: C.isTablet ? 80 : 40),
child: TextFormField(
onSaved: C.onViewChanged(),
onSaved: C.onChanged(),
textAlign: TextAlign.center,
maxLines: 2,
cursorColor: textColor == 0 ? Colors.white : Colors.black,
Expand All @@ -81,7 +81,7 @@ class _EditVoiceState extends State<EditVoice> {
GestureDetector(
onTap: () {
textColor = textColor == 0 ? 1 : 0;
C.onColorChanged();
C.onChanged();
},
child: Padding(
padding: const EdgeInsets.only(bottom: 20.0),
Expand Down Expand Up @@ -166,7 +166,7 @@ class _EditVoiceState extends State<EditVoice> {
itemBuilder: (BuildContext context, index2) => GestureDetector(
onTap: () {
bIndex = index2;
C.onColorChanged();
C.onChanged();
},
child: CircleAvatar(
radius: 35,
Expand Down Expand Up @@ -204,7 +204,7 @@ class _EditVoiceState extends State<EditVoice> {
onTap: () {
index3 += 5;
bIndex = index3;
C.onColorChanged();
C.onChanged();
},
child: CircleAvatar(
radius: 35,
Expand Down
Loading

0 comments on commit 99af76a

Please sign in to comment.