Everionce
Everionce
3. Todo List: An interactive task management tool that helps users stay organized
and focused. Users can create, edit, and prioritize tasks, set due dates, and mark
completed tasks. The Todo List feature ensures that users can manage their daily
activities effectively.
4. Notes: A digital note-taking feature that allows users to jot down important
information and ideas. It provides a simple yet powerful writing platform where
users can create, edit, and organize their notes effortlessly. The app supports
rich text formatting and enables users to attach images for enhanced productivity.
Code:
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:math_expressions/math_expressions.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:timezone/timezone.dart' as tz;
import 'package:intl/intl.dart';
import 'package:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
void main() {
runApp(CalculatorApp());
}
@override
void initState() {
super.initState();
_animationController = AnimationController(
vsync: this,
duration: Duration(seconds: 2),
);
_animationController.forward();
}
@override
void dispose() {
_animationController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Home'),
),
body: SingleChildScrollView(
child: Column(
children: [
AnimatedBuilder(
animation: _animationController,
builder: (context, child) {
return Container(
color: Colors.cyan[300],
child: Center(
child: Opacity(
opacity: _opacityAnimation.value,
child: Transform.scale(
scale: _scaleAnimation.value,
child: Text(
'Welcome to EVERIONCE',
style: TextStyle(
fontSize: 45,
color: Colors.white,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
),
),
),
);
},
),
_buildFeatureCard(
'Calculator',
'Perform basic and scientific calculations',
() {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => CalculatorScreen(),
),
);
},
),
_buildFeatureCard(
'GST Calculator',
'Calculate GST for your transactions',
() {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => GstCalculator(),
),
);
},
),
_buildFeatureCard(
'Scientific Calculator',
'Perform advanced scientific calculations',
() {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ScientificCalculator(),
),
);
},
),
_buildFeatureCard(
'To-Do List',
'Keep track of your tasks and schedule',
() {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => TodoListScreen(),
),
);
},
),
_buildFeatureCard(
'Notes',
'Take and manage your notes easily',
() {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => NotesScreen(),
),
);
},
),
],
),
),
drawer: _buildDrawer(),
);
}
Widget _buildDrawer() {
return Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: [
DrawerHeader(
decoration: BoxDecoration(
color: Colors.blue,
),
child: Text(
'Menu',
style: TextStyle(
color: Colors.white,
fontSize: 24,
),
),
),
_buildDrawerItem('Home', () {
Navigator.pop(context);
}),
_buildDrawerItem('Calculator', () {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => CalculatorScreen(),
),
);
}),
_buildDrawerItem('GST Calculator', () {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => GstCalculator(),
),
);
}),
_buildDrawerItem('Scientific Calculator', () {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ScientificCalculator(),
),
);
}),
_buildDrawerItem('To-Do List', () {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => TodoListScreen(),
),
);
}),
_buildDrawerItem('Notes', () {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => NotesScreen(),
),
);
}),
],
),
);
}
void _showAddTaskDialog() {
showDialog(
context: context,
builder: (context) {
TextEditingController taskController = TextEditingController();
return AlertDialog(
title: Text('Add Task'),
content: Column(
children: [
TextField(
controller: taskController,
decoration: InputDecoration(hintText: 'Enter task'),
),
SizedBox(height: 16),
ElevatedButton(
onPressed: () async {
DateTime? selectedDate = await _selectDate(context);
if (selectedDate != null) {
TimeOfDay? selectedTime = await _selectTime(context);
if (selectedTime != null) {
selectedDateTime = DateTime(
selectedDate.year,
selectedDate.month,
selectedDate.day,
selectedTime.hour,
selectedTime.minute,
);
}
}
},
child: Text('Select Date and Time'),
),
],
),
actions: [
TextButton(
onPressed: () {
Navigator.pop(context);
},
child: Text('Cancel'),
),
TextButton(
onPressed: () {
setState(() {
tasks.add(Task(
taskName: taskController.text,
creationDate: DateTime.now(),
selectedDateTime: selectedDateTime,
));
});
Navigator.pop(context);
},
child: Text('Add'),
),
],
);
},
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Todo List'),
),
body: Container(
decoration: BoxDecoration(
color: Colors.blueGrey[50], // Light blue-grey background color
),
child: ListView.builder(
itemCount: tasks.length,
itemBuilder: (context, index) {
final task = tasks[index];
return Dismissible(
key: Key(task.creationDate.toString()),
onDismissed: (direction) {
_deleteTask(index);
},
background: Container(
color: Colors.red,
child: Icon(Icons.delete, color: Colors.white),
),
secondaryBackground: Container(
color: Colors.green,
child: Icon(Icons.check, color: Colors.white),
),
child: ListTile(
title: Text(
task.taskName,
style: TextStyle(
decoration: task.isComplete
? TextDecoration.lineThrough
: TextDecoration.none,
),
),
subtitle: task.selectedDateTime != null
? Text(
'Scheduled: $
{DateFormat.yMd().add_jm().format(task.selectedDateTime!)}')
: null,
trailing: task.isComplete
? Icon(
Icons.check,
color: Colors.green,
)
: null,
onTap: () {
_markComplete(index);
},
),
);
},
),
),
floatingActionButton: FloatingActionButton(
onPressed: _showAddTaskDialog,
child: Icon(Icons.add),
),
);
}
}
class Task {
final String taskName;
bool isComplete;
DateTime creationDate;
DateTime? selectedDateTime;
Task({
required this.taskName,
this.isComplete = false,
required this.creationDate,
this.selectedDateTime,
});
}
void _calculateResult() {
try {
Parser p = Parser();
Expression exp = p.parse(_expression);
ContextModel cm = ContextModel();
double eval = exp.evaluate(EvaluationType.REAL, cm);
setState(() {
_result = eval.toString();
});
} catch (e) {
setState(() {
_result = 'Error';
});
}
}
void _clearInput() {
setState(() {
_expression = '';
_result = '';
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Calculator'),
),
body: Container(
padding: EdgeInsets.all(16),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
border: Border.all(),
),
child: SingleChildScrollView(
child: Text(
_expression,
style: TextStyle(fontSize: 24),
),
),
),
),
SizedBox(height: 16),
Text(
_result,
style: TextStyle(fontSize: 36, fontWeight: FontWeight.bold),
),
SizedBox(height: 16),
GridView.builder(
shrinkWrap: true,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4,
crossAxisSpacing: 8,
mainAxisSpacing: 8,
),
itemCount: _buttonTexts.length,
itemBuilder: (context, index) {
return TextButton(
onPressed: () {
if (_buttonTexts[index] == '=') {
_calculateResult();
} else if (_buttonTexts[index] == 'C') {
_clearInput();
} else {
setState(() {
_expression += _buttonTexts[index];
});
}
},
child: Text(
_buttonTexts[index],
style: TextStyle(fontSize: 20),
),
);
},
),
],
),
),
);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('GST Calculator'),
leading: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () {
Navigator.pop(context);
},
),
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextField(
controller: _amountController,
keyboardType: TextInputType.number,
decoration: InputDecoration(labelText: 'Amount'),
),
SizedBox(height: 16),
TextField(
controller: _gstRateController,
keyboardType: TextInputType.number,
decoration: InputDecoration(labelText: 'GST Rate (%)'),
),
SizedBox(height: 16),
ElevatedButton(
onPressed: () {
double amount = double.tryParse(_amountController.text) ?? 0.0;
double gstRate = double.tryParse(_gstRateController.text) ?? 0.0;
double gstAmount = (amount * gstRate) / 100;
double totalAmount = amount + gstAmount;
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text('GST Calculation Result'),
content: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text('Original Amount: $amount'),
Text('GST Amount: $gstAmount'),
Text('Total Amount: $totalAmount'),
],
),
actions: [
TextButton(
onPressed: () {
Navigator.pop(context);
},
child: Text('OK'),
),
],
);
},
);
},
child: Text('Calculate GST'),
),
],
),
),
);
}
}
void _calculateResult() {
double result = eval(_input);
setState(() {
_input = result.toString();
});
}
void _clearInput() {
setState(() {
_input = '';
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Scientific Calculator'),
leading: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () {
Navigator.pop(context);
},
),
),
body: Column(
children: [
Expanded(
child: Container(
padding: EdgeInsets.all(16.0),
alignment: Alignment.bottomRight,
child: Text(
_input,
style: TextStyle(
fontSize: 32.0,
fontWeight: FontWeight.bold,
),
),
),
),
Divider(),
Expanded(
flex: 2,
child: GridView.builder(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 5,
),
itemBuilder: (context, index) {
final buttonText = _buttonTexts[index];
return TextButton(
onPressed: () => _onButtonPressed(buttonText),
child: Text(
buttonText,
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.bold,
),
),
);
},
itemCount: _buttonTexts.length,
),
),
],
),
);
}
void _addNote() {
showDialog(
context: context,
builder: (context) {
TextEditingController noteController = TextEditingController();
return AlertDialog(
title: Text('Add Note'),
content: TextField(
controller: noteController,
decoration: InputDecoration(hintText: 'Enter note'),
),
actions: [
TextButton(
onPressed: () {
Navigator.pop(context);
},
child: Text('Cancel'),
),
TextButton(
onPressed: () {
setState(() {
notes.add(noteController.text);
});
Navigator.pop(context);
},
child: Text('Add'),
),
],
);
},
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Notes'),
),
body: ListView.builder(
itemCount: notes.length,
itemBuilder: (context, index) {
return ListTile(
title: Text(notes[index]),
trailing: IconButton(
icon: Icon(Icons.delete),
onPressed: () {
_deleteNote(index);
},
),
);
},
),
floatingActionButton: FloatingActionButton(
onPressed: _addNote,
child: Icon(Icons.add),
),
);
}
}