Skip to content
Snippets Groups Projects
Commit 73adbfbe authored by Himali Aryal's avatar Himali Aryal
Browse files

added diary, emoji, image, sensor data, stress scalar

parent ac18b512
No related branches found
No related tags found
1 merge request!1added diary, emoji, image, sensor data, stress scalar
Showing
with 416 additions and 23 deletions
...@@ -24,6 +24,7 @@ if (flutterVersionName == null) { ...@@ -24,6 +24,7 @@ if (flutterVersionName == null) {
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'
android { android {
compileSdkVersion 29 compileSdkVersion 29
...@@ -39,7 +40,7 @@ android { ...@@ -39,7 +40,7 @@ android {
defaultConfig { defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.flutter_app" applicationId "com.example.flutter_app"
minSdkVersion 16 minSdkVersion 21
targetSdkVersion 29 targetSdkVersion 29
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
...@@ -61,3 +62,4 @@ flutter { ...@@ -61,3 +62,4 @@ flutter {
dependencies { dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
} }
{
"project_info": {
"project_number": "569630311749",
"project_id": "diary-151be",
"storage_bucket": "diary-151be.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:569630311749:android:7530a1e5e5bad246282a2c",
"android_client_info": {
"package_name": "com.example.flutter_app"
}
},
"oauth_client": [
{
"client_id": "569630311749-tasesjijtq8nfian8vrcnortt6b2m8fi.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyD0RdTgjSVPzi15P2Cvic4AAV_t3MR_7LE"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "569630311749-tasesjijtq8nfian8vrcnortt6b2m8fi.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
\ No newline at end of file
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.flutter_app"> package="com.example.flutter_app">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that <!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method. calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide In most cases you can leave this as-is, but you if you want to provide
......
...@@ -8,6 +8,7 @@ buildscript { ...@@ -8,6 +8,7 @@ buildscript {
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.5.0' classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.5'
} }
} }
......
org.gradle.jvmargs=-Xmx1536M org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
\ No newline at end of file
android.enableR8=true
include ':app'
assets/images/emoticon-angry.png

148 KiB

assets/images/emoticon-bored.png

167 KiB

assets/images/emoticon-happy.png

136 KiB

assets/images/emoticon-motivated.png

90.5 KiB

assets/images/emoticon-sleepy.png

73 KiB

assets/images/emoticon-tired.png

95.4 KiB

assets/images/emoticon-very-sad.png

255 KiB

images/slide_1.jpg

130 KiB

images/slide_2.jpg

117 KiB

images/slide_3.jpeg

460 KiB

import 'dart:io';
import 'package:path/path.dart';
import 'package:sqflite/sqflite.dart';
import 'package:path_provider/path_provider.dart';
class DatabaseHelper {
static final _databaseName = "diaryDB.db";
static final _databaseVersion = 1;
static final table = 'emotion_table';
static final columnId = '_id';
static final columnTitle = 'title';
static final columnContent = 'content';
// make this a singleton class
DatabaseHelper._privateConstructor();
static final DatabaseHelper instance = DatabaseHelper._privateConstructor();
// only have a single app-wide reference to the database
static Database _database;
Future<Database> get database async {
if (_database != null) return _database;
// lazily instantiate the db the first time it is accessed
_database = await _initDatabase();
return _database;
}
// this opens the database (and creates it if it doesn't exist)
_initDatabase() async {
Directory documentsDirectory = await getApplicationDocumentsDirectory();
String path = join(documentsDirectory.path, _databaseName);
return await openDatabase(path,
version: _databaseVersion,
onCreate: _onCreate);
}
// SQL code to create the database table
Future _onCreate(Database db, int version) async {
await db.execute('''
CREATE TABLE $table (
$columnId INTEGER PRIMARY KEY,
$columnTitle TEXT NOT NULL,
$columnContent TEXT NOT NULL
)
''');
}
// Helper methods
// Inserts a row in the database where each key in the Map is a column name
// and the value is the column value. The return value is the id of the
// inserted row.
Future<int> insert(Map<String, dynamic> row) async {
Database db = await instance.database;
return await db.insert(table, row);
}
// All of the rows are returned as a list of maps, where each map is
// a key-value list of columns.
Future<List<Map<String, dynamic>>> queryAllRows() async {
Database db = await instance.database;
return await db.query(table);
}
// All of the methods (insert, query, update, delete) can also be done using
// raw SQL commands. This method uses a raw query to give the row count.
Future<int> queryRowCount() async {
Database db = await instance.database;
return Sqflite.firstIntValue(await db.rawQuery('SELECT COUNT(*) FROM $table'));
}
// We are assuming here that the id column in the map is set. The other
// column values will be used to update the row.
Future<int> update(Map<String, dynamic> row) async {
Database db = await instance.database;
int id = row[columnId];
return await db.update(table, row, where: '$columnId = ?', whereArgs: [id]);
}
// Deletes the row specified by the id. The number of affected rows is
// returned. This should be 1 as long as the row exists.
Future<int> delete(int id) async {
Database db = await instance.database;
return await db.delete(table, where: '$columnId = ?', whereArgs: [id]);
}
}
\ No newline at end of file
// import 'package:flutter_app/models/diary.dart';
// import 'package:path/path.dart';
// import 'package:sqflite/sqflite.dart';
// import 'package:sqflite/sqlite_api.dart';
//
// class DatabaseProvider {
// static const String TABLE_DIARY = "diary";
// static const String COLUMN_ID = "id";
// static const String COLUMN_TITLE = "title";
// static const String COLUMN_CONTENT = "content";
// static const String COLUMN_CREATEDAT = "createdAt";
//
// DatabaseProvider._();
// static final DatabaseProvider db = DatabaseProvider._();
//
// Database _database;
//
// Future<Database> get database async {
// print("database getter called");
//
// if (_database != null) {
// return _database;
// }
//
// _database = await createDatabase();
//
// return _database;
// }
//
// Future<Database> createDatabase() async {
// String dbPath = await getDatabasesPath();
//
// return await openDatabase(
// join(dbPath, 'diaryDB.db'),
// version: 1,
// onCreate: (Database database, int version) async {
// print("Creating diary entry table");
//
// await database.execute(
// "CREATE TABLE $TABLE_DIARY ("
// "$COLUMN_ID INTEGER PRIMARY KEY,"
// "$COLUMN_TITLE TEXT,"
// "$COLUMN_CONTENT TEXT,"
// "$COLUMN_CREATEDAT TEXT"
// ")",
// );
// },
// );
// }
//
// Future<List<Diary>> getdiarys() async {
// final db = await database;
//
// var diarys = await db
// .query(TABLE_DIARY, columns: [COLUMN_ID, COLUMN_TITLE, COLUMN_CONTENT, COLUMN_CREATEDAT]);
//
// List<Diary> foodList = List<Diary>();
//
// diarys.forEach((currentDiary) {
// Diary food = Diary.fromMap(currentDiary);
//
// foodList.add(food);
// });
//
// return foodList;
// }
//
// Future<Diary> insert(Diary diary) async {
// final db = await database;
// diary.id = await db.insert(TABLE_DIARY, diary.toMap());
// return diary;
// }
//
// Future<int> delete(int id) async {
// final db = await database;
//
// return await db.delete(
// TABLE_DIARY,
// where: "id = ?",
// whereArgs: [id],
// );
// }
//
// Future<int> update(Diary diary) async {
// final db = await database;
//
// return await db.update(
// TABLE_DIARY,
// diary.toMap(),
// where: "id = ?",
// whereArgs: [diary.id],
// );
// }
// }
\ No newline at end of file
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_app/ui/entries/select_page.dart';
import 'package:flutter_app/ui/common/slide_up_route.dart';
void main() => runApp(MaterialApp( void main() => runApp(MaterialApp(
home: Scaffold( home: Home(),
));
class Home extends StatefulWidget {
static const routeName = 'home';
// final dbHelper = DatabaseHelper.instance;
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State<Home> {
int _currentIndex = 0;
// final List<Widget> _pages = [ListEntries(), Profile()];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('Diary Entry - Homepage'), title: Text('WELCOME TO DIARY ENTRY 😊'),
centerTitle: true, centerTitle: true,
backgroundColor: Color(0xFF3C4858)
), ),
body: Center( body: IndexedStack(
index: _currentIndex,
children: <Widget>[
Container(
alignment: Alignment.center,
margin: EdgeInsets.only(bottom: 15.0),
child: Text( child: Text(
'Welcome to your diary', '\t No entries yet \n\n\nClick the + button to start:',
style: TextStyle( style: TextStyle(fontSize: 20.0),
fontSize: 20.0,
color: Colors.grey[600],
letterSpacing: 2.0,
fontWeight: FontWeight.bold,
), ),
), ),
Container(
alignment: Alignment.center,
child: Text('Click the + button to start:'),
) , ) ,
floatingActionButton: FloatingActionButton( ],
child: Text('+'), // children: _pages,
), ),
bottomNavigationBar: BottomNavigationBar(
currentIndex: _currentIndex,
showSelectedLabels: false,
showUnselectedLabels: false,
onTap: _onBottomNavTapped,
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.home),
title: Text('Home'),
), ),
BottomNavigationBarItem(
icon: Icon(Icons.person), title: Text('Profile'))
]),
floatingActionButton: FloatingActionButton(
backgroundColor: Color(0xFF3C4858),
child: Icon(Icons.add),
// onPressed: () => {},
onPressed: () =>
Navigator.of(context).push(SlideUpRoute(widget: Selectentries())),
),
floatingActionButtonLocation:
FloatingActionButtonLocation.centerDocked);
}
)); void _onBottomNavTapped(int index) {
setState(() {
_currentIndex = index;
});
}
}
// import 'package:flutter_app/managers/app_manager.dart';
// import 'package:flutter_app/services/api_service.dart';
// import 'package:flutter_app/view_model/entry.dart';
// import 'package:flutter/services.dart';
// import 'package:provider/provider.dart';
// import 'services/locator.dart';
// import 'ui/auth/login.dart';
// import 'ui/auth/signup.dart';
// import 'ui/entries/add_entries.dart';
// import 'ui/entries/edit_entry.dart';
// import 'ui/entries/view_entry.dart';
// import 'ui/home.dart';
// import 'ui/intro/intro.dart';
// import 'ui/root.dart';
// import 'view_model/user.dart';
//
// List<Future> systemChromeTasks = [
// SystemChrome.setEnabledSystemUIOverlays([]),
// SystemChrome.setPreferredOrientations([
// DeviceOrientation.portraitUp,
// DeviceOrientation.portraitDown,
// ]),
// ];
// void main() async {
// WidgetsFlutterBinding.ensureInitialized();
// await Future.wait(systemChromeTasks);
// setupLocator();
// await setupApi();
//
// return runApp(
// MultiProvider(
// providers: [
// ChangeNotifierProvider(
// builder: (context) => UserViewModel(),
// ),
// ChangeNotifierProvider(
// builder: (context) => EntryViewModel(),
// ),
// ],
// child: Diary(),
// ),
// );
// }
//
// Future<void> setupApi() async {
// await locator<ApiService>().clientSetup();
// }
//
// class Diary extends StatelessWidget {
// @override
// Widget build(BuildContext context) {
// return MaterialApp(
// title: 'Diary',
// debugShowCheckedModeBanner: false,
// theme: ThemeData(
// inputDecorationTheme: InputDecorationTheme(
// hintStyle: TextStyle(color: Color(0xFFC4C4C4), fontSize: 20.0),
// focusedBorder: UnderlineInputBorder(
// borderSide: BorderSide(color: Color(0xFF3C4858), width: 2.0),
// ),
// enabledBorder: UnderlineInputBorder(
// borderSide: BorderSide(color: Colors.black45, width: 2.0),
// ),
// ),
// primaryColor: Color(0xFF3C4858),
// primaryIconTheme: IconThemeData(color: Color(0xFF3C4858)),
// textTheme: TextTheme(
// title: TextStyle(color: Color(0xFF414A53)),
// subhead: TextStyle(color: Color(0xFF686B6F)),
// )),
// builder: (context, widget) => Navigator(
// onGenerateRoute: (settings) => MaterialPageRoute(
// builder: (context) => AppManager(
// child: widget,
// ),
// ),
// ),
// initialRoute: '/',
// routes: {
// '/': (context) => Root(),
// Intro.routeName: (context) => Intro(),
// Login.routeName: (context) => Login(),
// SignUp.routeName: (context) => SignUp(),
// Home.routeName: (context) => Home(),
// ViewEntry.routeName: (context) => ViewEntry(),
// AddEntry.routeName: (context) => AddEntry(),
// EditEntry.routeName: (context) => EditEntry(),
// },
// );
// }
// }
import 'package:flutter/widgets.dart';
class SlideUpRoute extends PageRouteBuilder {
Widget widget;
SlideUpRoute({this.widget})
: super(
pageBuilder: (BuildContext context, Animation<double> animation,
Animation<double> secondaryAnimation) {
return widget;
},
transitionDuration: Duration(milliseconds: 260),
transitionsBuilder: (BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
Widget child) {
Animation<Offset> slideUpAnim = Tween<Offset>(
begin: const Offset(0.0, 1.0),
end: Offset.zero,
).chain(CurveTween(curve: Curves.easeInOutSine)).animate(animation);
return SlideTransition(position: slideUpAnim, child: child);
});
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment