Skip to content

Commit

Permalink
Go Back to the old text editor.
Browse files Browse the repository at this point in the history
  • Loading branch information
I-AQ committed May 14, 2024
1 parent e4386ba commit bc97dbd
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 62 deletions.
24 changes: 19 additions & 5 deletions lib/ui/add_note_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class NoteAddScreen extends StatelessWidget {
NoteAddScreen({super.key});

final _titleController = TextEditingController();
final _bodyController = QuillController.basic();
final _bodyController = TextEditingController();

@override
Widget build(BuildContext context) {
Expand All @@ -26,11 +26,11 @@ class NoteAddScreen extends StatelessWidget {
stream: colorCubit.stream,
builder: (context, snapshot) {
return Scaffold(
bottomSheet: QuillToolbarWidget(_bodyController),
appBar: AddNoteAppBar(
color: colorCubit.state.noteColor,
onSavePress: () => saveNote(notesCubit, colorCubit, context),
onDeletPressed: () async {
if (_bodyController.text.isNotEmpty) {
showDialog(
context: context,
builder: (BuildContext context) {
Expand Down Expand Up @@ -68,7 +68,9 @@ class NoteAddScreen extends StatelessWidget {
],
);
},
);
);} else {
Navigator.pop(context);
}
},
onColorChangePress: () => changeColor(context, colorCubit),
),
Expand All @@ -94,7 +96,19 @@ class NoteAddScreen extends StatelessWidget {
fontFamily: "Nothing"),
),
const SizedBox(height: 14),
quillEditorPropertys(_bodyController)
TextField(
controller: _bodyController,
textCapitalization: TextCapitalization.sentences,
keyboardType: TextInputType.multiline,
maxLines: null,
decoration: const InputDecoration(
hintText: 'Text',
fillColor: CustomColors.backgroundColor,
),
style: const TextStyle(
color: Colors.white,
fontSize: 16,),
),
],
),
),
Expand Down Expand Up @@ -154,7 +168,7 @@ class NoteAddScreen extends StatelessWidget {
if (_titleController.text.isNotEmpty) {
cubit.addNote(
_titleController.text,
jsonEncode(_bodyController.document.toDelta().toJson()),
_bodyController.text,
colorCubit.state.noteColor);
Navigator.pop(context);
break;
Expand Down
12 changes: 5 additions & 7 deletions lib/ui/main_screen_with_content_grid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ class MainScreenWithContentGridView extends StatelessWidget {
fontFamily: "Nothing"),
),
subtitle: Text(
Document.fromJson(
json.decode(notes[index].content))
.toPlainText(),
notes[index].content,
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
Expand All @@ -131,15 +129,15 @@ class MainScreenWithContentGridView extends StatelessWidget {
}

Color textColor(Color indexColor) {
if (indexColor == const Color.fromRGBO(239, 239, 239, 1.0)) {
if (indexColor == const Color.fromRGBO(231,233,233, 1.0)) {
return Colors.black54;
} else {
return Colors.white54;
}
}

Color titleColor(Color indexColor) {
if (indexColor == const Color.fromRGBO(239, 239, 239, 1.0)) {
if (indexColor == const Color.fromRGBO(231,233,233, 1.0)) {
return Colors.black;
} else {
return Colors.white;
Expand All @@ -154,9 +152,9 @@ Widget addNoteButton(BuildContext context) {
Navigator.pushNamed(context, '/add'),
},
elevation: 24,
backgroundColor: CustomColors.red,
backgroundColor: CustomColors.lightGrey,
shape: RoundedRectangleBorder(
side: const BorderSide(color: CustomColors.lightGrey, width: 2),
side: const BorderSide( width: 0),
borderRadius: BorderRadius.circular(
40,
),
Expand Down
22 changes: 15 additions & 7 deletions lib/ui/show_note_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ShowNoteScreen extends StatelessWidget {
ShowNoteScreen({super.key});

final _titleController = TextEditingController();
final _bodyController = QuillController.basic();
final _bodyController = TextEditingController();

@override
Widget build(BuildContext context) {
Expand All @@ -26,14 +26,13 @@ class ShowNoteScreen extends StatelessWidget {

colorCubit.changeColor(note.color);
_titleController.text = note.title;
_bodyController.document = Document.fromJson(json.decode(note.content));
_bodyController.text = note.content;

return StreamBuilder<NotesColorState>(
stream: colorCubit.stream,
initialData: colorCubit.state,
builder: (context, snapshot) {
return Scaffold(
bottomSheet: QuillToolbarWidget(_bodyController),
appBar: ShowNoteAppBar(
onBackPressed: () async {
await saveChanges(context, cubit, colorCubit, note);
Expand Down Expand Up @@ -96,7 +95,18 @@ class ShowNoteScreen extends StatelessWidget {
fontFamily: "Nothing"),
),
const SizedBox(height: 14),
quillEditorPropertys(_bodyController)
TextField(
controller: _bodyController,
textCapitalization: TextCapitalization.sentences,
keyboardType: TextInputType.multiline,
maxLines: null,
decoration: const InputDecoration(
fillColor: CustomColors.backgroundColor,
),
style: const TextStyle(
color: Colors.white,
fontSize: 16,),
),
],
),
),
Expand Down Expand Up @@ -157,9 +167,7 @@ class ShowNoteScreen extends StatelessWidget {
cubit.updateNote(Note(
id: note.id,
title: _titleController.text,
content: jsonEncode(
_bodyController.document.toDelta().toJson(),
),
content: _bodyController.text,
color: colorCubit.state.noteColor));
Navigator.pop(context);
return false;
Expand Down
77 changes: 35 additions & 42 deletions lib/ui/tasks_screen.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:app_client/ui/theme/custom_colors.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:sqflite/sqflite.dart';
import 'package:path/path.dart';
Expand Down Expand Up @@ -27,8 +28,8 @@ class _TaskListScreenState extends State<TaskListScreen> {
) {
return FloatingActionButton(
shape: const CircleBorder(
side: BorderSide(width: 3, color: CustomColors.lightGrey)),
backgroundColor: CustomColors.whiteMain,
side: BorderSide()),
backgroundColor: CustomColors.lightGrey,
onPressed: () {
_addTask(context);
},
Expand Down Expand Up @@ -98,9 +99,10 @@ class _TaskListScreenState extends State<TaskListScreen> {
alignment: Alignment.centerRight,
decoration: BoxDecoration(
border: Border.all(
color: CustomColors.backgroundColor,
width: 2,
),
borderRadius: const BorderRadius.all(Radius.circular(20))),
borderRadius: const BorderRadius.all(Radius.circular(14))),
child: const Padding(
padding: EdgeInsets.all(10),
child: Icon(
Expand All @@ -124,37 +126,33 @@ class _TaskListScreenState extends State<TaskListScreen> {
width: 2,
),
borderRadius:
const BorderRadius.all(Radius.circular(50))),
const BorderRadius.all(Radius.circular(14))),
child: Container(
padding: taskPadding(sublistNR),
decoration: const BoxDecoration(),
child: CheckboxListTile(
checkboxShape: const CircleBorder(
side: BorderSide(
color: CustomColors.lightGrey,
color: CustomColors.backgroundColor,
)),
title: Text(tasks[index].task,
style: const TextStyle(
color: CustomColors.backgroundColor)),
title: Row(children: [
Text(tasks[index].task,
style: const TextStyle(
color: CustomColors.backgroundColor)),
addTask(sublistNR, _taskWidget(
task,
context,
ptId,
sublistNR,
))

],),
value: tasks[index].isDone == 1,
onChanged: (bool? value) {
_toggleTask(tasks[index]);
},
),
)),
Visibility(
visible: (sublistNR < 2),
child: Padding(
padding: const EdgeInsets.only(bottom: 10),
child: Container(
child: _taskWidget(
task,
context,
ptId,
sublistNR,
)),
),
),
],
);
},
Expand All @@ -175,9 +173,17 @@ class _TaskListScreenState extends State<TaskListScreen> {
}
}

Widget addTask(int sublistNR,Widget TaskW ){
if (sublistNR < 2){
return TaskW;}else{
return Container();
}

}

EdgeInsets taskPadding(int sublistNR) {
if (sublistNR == 0) {
return const EdgeInsets.all(10);
return const EdgeInsets.all(3);
} else {
return const EdgeInsets.all(0);
}
Expand Down Expand Up @@ -217,8 +223,8 @@ class _TaskListScreenState extends State<TaskListScreen> {
if (subtasks.isNotEmpty && task.isDone == 0) {
return ExpansionTile(
shape: const RoundedRectangleBorder(
side: BorderSide(color: CustomColors.greyHint, width: 5),
borderRadius: BorderRadius.all(Radius.circular((50))),
side: BorderSide( width: 5),
borderRadius: BorderRadius.all(Radius.circular((30))),
),
backgroundColor: CustomColors.greyHint,
childrenPadding: const EdgeInsets.symmetric(horizontal: 20),
Expand All @@ -228,7 +234,7 @@ class _TaskListScreenState extends State<TaskListScreen> {
title: InkWell(
splashColor: CustomColors.whiteMain,
customBorder: RoundedRectangleBorder(
side: const BorderSide(color: CustomColors.lightGrey, width: 2),
side: const BorderSide( width: 2),
borderRadius: BorderRadius.circular(
40,
),
Expand Down Expand Up @@ -283,7 +289,7 @@ class _TaskListScreenState extends State<TaskListScreen> {
borderRadius: const BorderRadius.all(Radius.circular(50))),
child: InkWell(
customBorder: RoundedRectangleBorder(
side: const BorderSide(color: CustomColors.lightGrey, width: 2),
side: const BorderSide( width: 2),
borderRadius: BorderRadius.circular(
40,
),
Expand All @@ -304,21 +310,6 @@ class _TaskListScreenState extends State<TaskListScreen> {
padding: const EdgeInsets.symmetric(horizontal: 0),
child: const Icon(Icons.add, color: CustomColors.lightGrey),
),
Container(
decoration: BoxDecoration(
color: CustomColors.whiteMain,
border: Border.all(
width: 2,
),
borderRadius:
const BorderRadius.all(Radius.circular(50))),
padding: const EdgeInsets.symmetric(horizontal: 20),
child: const Text(
'Add Subtask',
style:
TextStyle(color: CustomColors.lightGrey, fontSize: 16),
),
),
],
),
),
Expand Down Expand Up @@ -392,13 +383,15 @@ class _TaskListScreenState extends State<TaskListScreen> {
context: context,
builder: (BuildContext context) {
return AlertDialog(
surfaceTintColor: Colors.black,
backgroundColor: CustomColors.lightGrey,
title: const Text(
'Add Task',
style: TextStyle(fontSize: 20),
),
content: TextField(
decoration: InputDecoration(
fillColor: CustomColors.greyHint,
fillColor: CustomColors.backgroundColor,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(20),
borderSide: const BorderSide(
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: A new Flutter project.

publish_to: 'none'

version: 0.3.1+1
version: 0.3.2

environment:
sdk: ">=2.17.5 <3.7.0"
Expand Down

0 comments on commit bc97dbd

Please sign in to comment.