diff --git a/android/app/build.gradle b/android/app/build.gradle index 7fdfbbb99f5fae0048ad049a89aa9b907dba02bb..c6226fd84738a180442c4c164d1e0241e78c1536 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -24,6 +24,7 @@ if (flutterVersionName == null) { apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" +apply plugin: 'com.google.gms.google-services' android { compileSdkVersion 29 @@ -39,7 +40,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.flutter_app" - minSdkVersion 16 + minSdkVersion 21 targetSdkVersion 29 versionCode flutterVersionCode.toInteger() versionName flutterVersionName @@ -61,3 +62,4 @@ flutter { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } + diff --git a/android/app/google-services.json b/android/app/google-services.json new file mode 100644 index 0000000000000000000000000000000000000000..dc38ecc07a765280c3c3442d6e51174f03c763b7 --- /dev/null +++ b/android/app/google-services.json @@ -0,0 +1,39 @@ +{ + "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 diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index a488615106b167ca201895d998816084eab00179..5c9f61690f6c0e9774de6ccbce98e43bf4c550e3 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,11 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.flutter_app"> + package="com.example.flutter_app" + xmlns:tools="http://schemas.android.com/tools"> + + <uses-permission + android:name="android.permission.PACKAGE_USAGE_STATS" + tools:ignore="ProtectedPermissions"/> + <!-- io.flutter.app.FlutterApplication is an android.app.Application that calls FlutterMain.startInitialization(this); in its onCreate method. In most cases you can leave this as-is, but you if you want to provide diff --git a/android/build.gradle b/android/build.gradle index 3100ad2d55532e58ed44b53dd3c2a04c5bcaf160..e62a6411b1c21b574a67dd05eb95c9b82ed6d946 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -8,6 +8,7 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:3.5.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath 'com.google.gms:google-services:4.3.5' } } diff --git a/android/gradle.properties b/android/gradle.properties index 9364cf496fffb3a3aec2c0a2ca9ebae84f28c600..a5965ab8dced71464f52d81becbc8397b4610413 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,4 +1,4 @@ -org.gradle.jvmargs=-Xmx512M -android.useAndroidX=true -android.enableJetifier=true +org.gradle.jvmargs=-Xmx1536M android.enableR8=true +android.useAndroidX=true +android.enableJetifier=true \ No newline at end of file diff --git a/android/settings_aar.gradle b/android/settings_aar.gradle new file mode 100644 index 0000000000000000000000000000000000000000..e7b4def49cb53d9aa04228dd3edb14c9e635e003 --- /dev/null +++ b/android/settings_aar.gradle @@ -0,0 +1 @@ +include ':app' diff --git a/assets/images/emoticon-angry.png b/assets/images/emoticon-angry.png new file mode 100644 index 0000000000000000000000000000000000000000..c17f857cd0eeeede2540caeef35a8cffb57a1c43 Binary files /dev/null and b/assets/images/emoticon-angry.png differ diff --git a/assets/images/emoticon-bored.png b/assets/images/emoticon-bored.png new file mode 100644 index 0000000000000000000000000000000000000000..c8105df1a0aae3d60ec7273184914e4646779ec0 Binary files /dev/null and b/assets/images/emoticon-bored.png differ diff --git a/assets/images/emoticon-happy.png b/assets/images/emoticon-happy.png new file mode 100644 index 0000000000000000000000000000000000000000..63edb9467d5f6d2be9dbc0f2533f4312bd427e2c Binary files /dev/null and b/assets/images/emoticon-happy.png differ diff --git a/assets/images/emoticon-motivated.png b/assets/images/emoticon-motivated.png new file mode 100644 index 0000000000000000000000000000000000000000..e1226e3d26ae9899d8154dd5143a9c03db4dbe77 Binary files /dev/null and b/assets/images/emoticon-motivated.png differ diff --git a/assets/images/emoticon-sleepy.png b/assets/images/emoticon-sleepy.png new file mode 100644 index 0000000000000000000000000000000000000000..9ad1bf6d0c9521e7231283d85de5f93996066ad2 Binary files /dev/null and b/assets/images/emoticon-sleepy.png differ diff --git a/assets/images/emoticon-tired.png b/assets/images/emoticon-tired.png new file mode 100644 index 0000000000000000000000000000000000000000..5edd53e05834f28d91cd18fbe81147dc09b24052 Binary files /dev/null and b/assets/images/emoticon-tired.png differ diff --git a/assets/images/emoticon-very-sad.png b/assets/images/emoticon-very-sad.png new file mode 100644 index 0000000000000000000000000000000000000000..84df9ad439b2aefad182b4d780a0535d328e9ffc Binary files /dev/null and b/assets/images/emoticon-very-sad.png differ diff --git a/images/slide_1.jpg b/images/slide_1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4d26a7fb61f0131f9a593c7ffcffeffa378171f6 Binary files /dev/null and b/images/slide_1.jpg differ diff --git a/images/slide_2.jpg b/images/slide_2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3321fc3a1da87592eb272d47425bd2ee61801b9f Binary files /dev/null and b/images/slide_2.jpg differ diff --git a/images/slide_3.jpeg b/images/slide_3.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..98a9380f329b08688a0493eda7a23e490315e037 Binary files /dev/null and b/images/slide_3.jpeg differ diff --git a/lib/db/database_helper.dart b/lib/db/database_helper.dart new file mode 100644 index 0000000000000000000000000000000000000000..f13de957178f62069f101f63ef3e12f4b0160970 --- /dev/null +++ b/lib/db/database_helper.dart @@ -0,0 +1,89 @@ +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 diff --git a/lib/db/database_provider.dart b/lib/db/database_provider.dart new file mode 100644 index 0000000000000000000000000000000000000000..7bde841183b2adc5281596311b261e4988a1f51a --- /dev/null +++ b/lib/db/database_provider.dart @@ -0,0 +1,94 @@ +// 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 diff --git a/lib/main.dart b/lib/main.dart index b53a2fdd41d54dc96c9115f696ee1de48545a4fe..b469140df001f5a987f9335595459dc1a090a046 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,46 +1,82 @@ import 'dart:async'; import 'package:flutter/material.dart'; -import 'package:flutter_sensors/flutter_sensors.dart'; +import 'package:flutter_app/ui/entries/select_page.dart'; +import 'package:flutter_app/ui/common/slide_up_route.dart'; -void main() => runApp(MyApp()); -class MyApp extends StatefulWidget { - @override - _MyAppState createState() => _MyAppState(); -} +void main() => runApp(MaterialApp( + home: Home(), +)); + -class _MyAppState extends State<MyApp> { - bool _accelAvailable = false; - bool _gyroAvailable = false; - List<double> _accelData = List.filled(3, 0.0); - List<double> _gyroData = List.filled(3, 0.0); - StreamSubscription _accelSubscription; - StreamSubscription _gyroSubscription; +class Home extends StatefulWidget { + static const routeName = 'home'; + // final dbHelper = DatabaseHelper.instance; @override - void initState() { - _checkAccelerometerStatus(); - _checkGyroscopeStatus(); - super.initState(); - } + _HomeState createState() => _HomeState(); +} +class _HomeState extends State<Home> { + int _currentIndex = 0; + // final List<Widget> _pages = [ListEntries(), Profile()]; @override - void dispose() { - _stopAccelerometer(); - _stopGyroscope(); - super.dispose(); + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('WELCOME TO DIARY ENTRY 😊'), + centerTitle: true, + backgroundColor: Color(0xFF3C4858) + ), + body: IndexedStack( + index: _currentIndex, + children: <Widget>[ + Container( + alignment: Alignment.center, + margin: EdgeInsets.only(bottom: 15.0), + child: Text( + '\t No entries yet \n\n\nClick the + button to start:', + style: TextStyle(fontSize: 20.0), + ), + ), + Container( + alignment: Alignment.center, + child: Text('Click the + button to start:'), + ) , + ], + // 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 _checkAccelerometerStatus() async { - await SensorManager() - .isSensorAvailable(Sensors.ACCELEROMETER) - .then((result) { - setState(() { - _accelAvailable = result; - }); + void _onBottomNavTapped(int index) { + setState(() { + _currentIndex = index; }); } +} Future<void> _startAccelerometer() async { if (_accelSubscription != null) return; @@ -57,146 +93,94 @@ class _MyAppState extends State<MyApp> { } } - void _stopAccelerometer() { - if (_accelSubscription == null) return; - _accelSubscription.cancel(); - _accelSubscription = null; - } - - void _checkGyroscopeStatus() async { - await SensorManager().isSensorAvailable(Sensors.GYROSCOPE).then((result) { - setState(() { - _gyroAvailable = result; - }); - }); - } - - Future<void> _startGyroscope() async { - if (_gyroSubscription != null) return; - if (_gyroAvailable) { - final stream = - await SensorManager().sensorUpdates(sensorId: Sensors.GYROSCOPE); - _gyroSubscription = stream.listen((sensorEvent) { - setState(() { - _gyroData = sensorEvent.data; - }); - }); - } - } - - void _stopGyroscope() { - if (_gyroSubscription == null) return; - _gyroSubscription.cancel(); - _gyroSubscription = null; - } - - @override - Widget build(BuildContext context) { - return MaterialApp( - home: Scaffold( - appBar: AppBar( - title: const Text('Sensor Data'), - ), - body: Container( - padding: EdgeInsets.all(16.0), - alignment: AlignmentDirectional.topCenter, - child: Column( - children: <Widget>[ - Text( - "Accelerometer Test", - textAlign: TextAlign.center, - ), - Text( - "Accelerometer Enabled: $_accelAvailable", - textAlign: TextAlign.center, - ), - Padding(padding: EdgeInsets.only(top: 16.0)), - Text( - "[0](X) = ${_accelData[0]}", - textAlign: TextAlign.center, - ), - Padding(padding: EdgeInsets.only(top: 16.0)), - Text( - "[1](Y) = ${_accelData[1]}", - textAlign: TextAlign.center, - ), - Padding(padding: EdgeInsets.only(top: 16.0)), - Text( - "[2](Z) = ${_accelData[2]}", - textAlign: TextAlign.center, - ), - Padding(padding: EdgeInsets.only(top: 16.0)), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: <Widget>[ - MaterialButton( - child: Text("Start"), - color: Colors.green, - onPressed: _accelAvailable != null - ? () => _startAccelerometer() - : null, - ), - Padding( - padding: EdgeInsets.all(8.0), - ), - MaterialButton( - child: Text("Stop"), - color: Colors.red, - onPressed: _accelAvailable != null - ? () => _stopAccelerometer() - : null, - ), - ], - ), - Padding(padding: EdgeInsets.only(top: 16.0)), - Text( - "Gyroscope Test", - textAlign: TextAlign.center, - ), - Text( - "Gyroscope Enabled: $_gyroAvailable", - textAlign: TextAlign.center, - ), - Padding(padding: EdgeInsets.only(top: 16.0)), - Text( - "[0](X) = ${_gyroData[0]}", - textAlign: TextAlign.center, - ), - Padding(padding: EdgeInsets.only(top: 16.0)), - Text( - "[1](Y) = ${_gyroData[1]}", - textAlign: TextAlign.center, - ), - Padding(padding: EdgeInsets.only(top: 16.0)), - Text( - "[2](Z) = ${_gyroData[2]}", - textAlign: TextAlign.center, - ), - Padding(padding: EdgeInsets.only(top: 16.0)), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: <Widget>[ - MaterialButton( - child: Text("Start"), - color: Colors.green, - onPressed: - _gyroAvailable != null ? () => _startGyroscope() : null, - ), - Padding( - padding: EdgeInsets.all(8.0), - ), - MaterialButton( - child: Text("Stop"), - color: Colors.red, - onPressed: - _gyroAvailable != null ? () => _stopGyroscope() : null, - ), - ], - ), - ], - ), - ), - ), - ); - } -} \ No newline at end of file +// 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(), +// }, +// ); +// } +// } diff --git a/lib/ui/common/slide_up_route.dart b/lib/ui/common/slide_up_route.dart new file mode 100644 index 0000000000000000000000000000000000000000..32c7474c549cd97a1773aaf156c63442f305329d --- /dev/null +++ b/lib/ui/common/slide_up_route.dart @@ -0,0 +1,23 @@ +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); + }); +} diff --git a/lib/ui/entries/add_emojis.dart b/lib/ui/entries/add_emojis.dart new file mode 100644 index 0000000000000000000000000000000000000000..7de1eb79f58975657a06ed23193afb87d3f5484e --- /dev/null +++ b/lib/ui/entries/add_emojis.dart @@ -0,0 +1,146 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; +import 'package:flutter_app/db/database_helper.dart'; +class AddEmojis extends StatefulWidget { + @override + _AddEmojisState createState() => _AddEmojisState(); +} + +class _AddEmojisState extends State<AddEmojis> { + final dbHelper = DatabaseHelper.instance; + dynamic message; + @override + Widget build(BuildContext context) { + return Scaffold( + // appBar: AppBar( + // title: Text('Express Emotions directly 😊'), + // centerTitle: true, + // backgroundColor: Color(0xFF3C4858), + // ), + body: SafeArea( + child: SingleChildScrollView( + child: Stack( + children: <Widget>[ + Row( + children: [ + InkResponse( + onTap: () { + Navigator.of(context).pop(); + }, + child: Container( + padding: EdgeInsets.all(10), + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: Colors.black12), + borderRadius: BorderRadius.circular(100), + boxShadow: [ + BoxShadow( + color: Color(0xFF3C4858).withOpacity(.5), + offset: Offset(1.0, 10.0), + blurRadius: 10.0), + ], + ), + child: Icon( + Icons.arrow_downward, + semanticLabel: 'Back', + size: 22, + ), + ), + ), + ], + ), + Column( + children: [ + SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, + children:<Widget> [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children:<Widget> [ + // message = 'angry', + IconButton( + iconSize: 100.0, + onPressed: (){_insert();}, + icon: Image.asset('assets/images/emoticon-angry.png'), + ), + IconButton( + iconSize: 100.0, + onPressed: (){_insert();}, + icon: Image.asset('assets/images/emoticon-bored.png'), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + IconButton( + iconSize: 100.0, + onPressed: (){_insert();}, + icon: Image.asset('assets/images/emoticon-tired.png'), + ), + IconButton( + iconSize: 100.0, + onPressed: (){_insert();}, + icon: Image.asset('assets/images/emoticon-sleepy.png'), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + IconButton( + iconSize: 140.0, + onPressed: (){_insert();}, + icon: Image.asset('assets/images/emoticon-happy.png'), + ), + // ButtonTheme( + // height: 60, + // minWidth: 60, + // child: IconButton( + // icon: Image.asset('emoticon-very-sad.jpg'), + // // textColor: Colors.white, + // color: Colors.blue[600], + // // child: Text('Sad 😥😥', style: TextStyle(fontWeight:FontWeight.bold),), + // onPressed: (){}), + // ), + IconButton( + iconSize: 100.0, + onPressed: (){_insert();}, + icon: Image.asset('assets/images/emoticon-very-sad.png'), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: <Widget>[ + IconButton( + iconSize: 140.0, + onPressed: (){_insert();}, + icon: Image.asset('assets/images/emoticon-motivated.png'), + ), + ], + ) + ], + ), + ), + ], + ), + ], + ), + ), + ), + ); + } + void _insert() async { + // row to insert + Map<String, dynamic> row = { + DatabaseHelper.columnTitle : 'Current mood:', + DatabaseHelper.columnContent : 'Angry' + }; + final id = await dbHelper.insert(row); + print('inserted row id: $id'); + } +} diff --git a/lib/ui/entries/add_entries.dart b/lib/ui/entries/add_entries.dart new file mode 100644 index 0000000000000000000000000000000000000000..37d3aa4a4b9a37b19a98b0a0c185241b98c6bdcd --- /dev/null +++ b/lib/ui/entries/add_entries.dart @@ -0,0 +1,150 @@ +import 'package:firebase_core/firebase_core.dart'; +import 'package:firebase_database/firebase_database.dart'; +import 'package:flutter_app/utils/input_validator.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +// import 'package:provider/provider.dart'; +// import 'package:flutter_app/ui/common/slide_up_route.dart'; +// import 'package:flutter_app/ui/home.dart'; +// import 'package:flutter_app/db/database_provider.dart'; + + +// import 'package:flutter_app/main.dart'; + +class AddEntry extends StatefulWidget { + AddEntry({this.app}); + final FirebaseApp app; + static const routeName = 'add-entry'; + + + _AddEntryState createState() => _AddEntryState(); +} + +class _AddEntryState extends State<AddEntry> { + DatabaseReference _ref; + TextEditingController _titleController, _contentController; + + @override + void initState(){ + super.initState(); + _titleController = TextEditingController(); + _contentController = TextEditingController(); + _ref = FirebaseDatabase.instance.reference().child('diary'); + } + Widget build(BuildContext context) { + void saveContent() { + String title = _titleController.text; + String content = _contentController.text; + Map<String, String> diary = { + 'title' : title, + 'content' : content + }; + _ref.push().set(diary).then((value) { + Navigator.of(context).pop(); + }); + } + return Scaffold( + body: SafeArea( + child: Container( + padding: EdgeInsets.only(left: 20, right: 20, bottom: 10), + child: Stack( + children: <Widget>[ + ListView( + children: <Widget>[ + Theme( + data: ThemeData( + highlightColor: Colors.transparent, + splashColor: Colors.transparent, + inputDecorationTheme: + InputDecorationTheme(border: InputBorder.none), + ), + child: Form( + child: Column( + children: <Widget>[ + SizedBox(height: 45), + Padding( + padding: EdgeInsets.only(bottom: 20.0), + child: TextFormField( + controller: _titleController, + keyboardType: TextInputType.multiline, + minLines: 1, + maxLines: 3, + cursorColor: Color(0xFF3C4858), + style: TextStyle(fontWeight: FontWeight.bold), + textAlign: TextAlign.center, + decoration: InputDecoration( + hintText: 'Please enter today\'s topic', + ), + inputFormatters: [ + LengthLimitingTextInputFormatter(100), + ], + // validator: InputValidator.title, + // onSaved: (value) => _formData['Title'] = value, + ), + ), + TextFormField( + controller: _contentController, + keyboardType: TextInputType.multiline, + maxLines: null, + cursorColor: Color(0xFF3C4858), + decoration: InputDecoration.collapsed( + hintText: + 'Tell me about it, I don\'t snitch 🤐..'), + // validator: InputValidator.content, + // onSaved: (value) => _formData['content'] = value, + ), + ], + ), + ), + ), + ], + ), + Row( + children: <Widget>[ + InkResponse( + onTap: () { + Navigator.of(context).pop(); + }, + child: Container( + padding: EdgeInsets.all(10), + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: Colors.black12), + borderRadius: BorderRadius.circular(100), + boxShadow: [ + BoxShadow( + color: Color(0xFF3C4858).withOpacity(.5), + offset: Offset(1.0, 10.0), + blurRadius: 10.0), + ], + ), + child: Icon( + Icons.arrow_downward, + semanticLabel: 'Back', + size: 22, + ), + )), + ], + ), + ], + ), + ), + ), + floatingActionButton: FloatingActionButton( + backgroundColor: Color(0xFF3C4858), + child: + Icon( + Icons.check, + semanticLabel: 'Save', + ), + onPressed: () { + saveContent(); + }, + ), + ); + + + + + } +} diff --git a/lib/ui/entries/image_uploader.dart b/lib/ui/entries/image_uploader.dart new file mode 100644 index 0000000000000000000000000000000000000000..a35fe5c9124f01d73e63e192272bae17844ca5b2 --- /dev/null +++ b/lib/ui/entries/image_uploader.dart @@ -0,0 +1,203 @@ +import 'package:flutter/material.dart'; +import 'dart:io'; +import 'dart:convert'; +import 'package:http/http.dart' as http; +import 'package:image_picker/image_picker.dart'; + + +class ImageUploader extends StatefulWidget { + ImageUploader() : super(); + final String title = "Upload Image"; + @override + _ImageUploaderState createState() => _ImageUploaderState(); +} + + +class _ImageUploaderState extends State<ImageUploader> { + static final String uploadEndPoint = + 'http://localhost/flutter_test/upload_image.php'; + Future<File> file; + String status = ''; + String base64Image; + File tmpFile; + String errMessage = 'Error Uploading Image'; + File _image; + final picker = ImagePicker(); + + + // Future getImage() async { + // final pickedFile = await picker.getImage(source: ImageSource.camera); + // + // setState(() { + // _image = File(pickedFile.path); + // }); + // } + _imgFromCamera() async { + File image = await ImagePicker.pickImage( + source: ImageSource.camera, imageQuality: 50 + ); + + setState(() { + _image = image; + }); + } + + _imgFromGallery() async { + File image = await ImagePicker.pickImage( + source: ImageSource.gallery, imageQuality: 50 + ); + + setState(() { + _image = image; + }); + } + + + chooseImage() { + setState(() { + file = ImagePicker.pickImage(source: ImageSource.gallery); + }); + } + + + setStatus(String message) { + setState(() { + status = message; + }); + } + + startUpload() { + setStatus('Uploading Image...'); + if (null == tmpFile) { + setStatus(errMessage); + return; + } + String fileName = tmpFile.path.split('/').last; + upload(fileName); + } + + upload(String fileName) { + http.post(uploadEndPoint, body: { + "image": base64Image, + "name": fileName, + }).then((result) { + setStatus(result.statusCode == 200 ? result.body : errMessage); + }).catchError((error) { + setStatus(error); + }); + } + + Widget showImage() { + return FutureBuilder<File>( + future: file, + builder: (BuildContext context, AsyncSnapshot<File> snapshot) { + if (snapshot.connectionState == ConnectionState.done && + null != snapshot.data) { + tmpFile = snapshot.data; + base64Image = base64Encode(snapshot.data.readAsBytesSync()); + return Flexible( + child: Image.file( + snapshot.data, + fit: BoxFit.fill, + ), + ); + } else if (null != snapshot.error) { + return const Text( + 'Error Picking Image', + textAlign: TextAlign.center, + ); + } else { + return const Text( + 'No Image Selected', + textAlign: TextAlign.center, + ); + } + }, + ); + } + + void _showPicker(context) { + showModalBottomSheet( + context: context, + builder: (BuildContext bc) { + return SafeArea( + child: Center( + child: RaisedButton( + child: new Wrap( + children: <Widget>[ + new ListTile( + leading: new Icon(Icons.photo_library), + title: new Text('Photo Library'), + onTap: () { + _imgFromGallery(); + Navigator.of(context).pop(); + }), + new ListTile( + leading: new Icon(Icons.photo_camera), + title: new Text('Camera'), + onTap: () { + _imgFromCamera(); + Navigator.of(context).pop(); + }, + ), + ], + ), + ), + ), + ); + } + ); + } + + + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text("Upload Image"), + centerTitle: true, + backgroundColor: Color(0xFF3C4858) + ), + body: Column( + children: <Widget>[ + SizedBox( + height: 32, + ), + Center( + child: GestureDetector( + onTap: () { + _showPicker(context); + }, + child: Card( + // radius: 55, + // backgroundColor: Colors.white, + child: _image != null + ? ClipRRect( + borderRadius: BorderRadius.circular(8.0), + child: Image.file( + _image, + width: 400.0, + height: 400.0, + // fit: BoxFit.fitHeight, + ), + ) + : Container( + decoration: BoxDecoration( + color: Colors.grey[200], + borderRadius: BorderRadius.circular(50.0)), + width: 100, + height: 100, + child: Icon( + // child: Text('Upload Image'), + Icons.camera_alt, + color: Colors.grey[800], + ), + ), + ), + ), + ) + ], + ), + ); + }} \ No newline at end of file diff --git a/lib/ui/entries/range_slider.dart b/lib/ui/entries/range_slider.dart new file mode 100644 index 0000000000000000000000000000000000000000..fe0ed28b6bd72296143fd569172f24095a057740 --- /dev/null +++ b/lib/ui/entries/range_slider.dart @@ -0,0 +1,96 @@ +import 'package:flutter/material.dart'; +import 'package:demoji/demoji.dart'; + +class StressSlider extends StatefulWidget { + @override + _StressSliderState createState() => _StressSliderState(); +} + +class _StressSliderState extends State<StressSlider> { + double _value = 0; + @override + Widget build(BuildContext context) { + return Scaffold( + body: SafeArea( + child: Container( + child: Stack( + children: <Widget>[ + Row( + children: <Widget>[ + InkResponse( + onTap: () { + Navigator.of(context).pop(); + }, + child: Container( + padding: EdgeInsets.all(10), + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: Colors.black12), + borderRadius: BorderRadius.circular(100), + boxShadow: [ + BoxShadow( + color: Color(0xFF3C4858).withOpacity(.5), + offset: Offset(1.0, 10.0), + blurRadius: 10.0), + ], + ), + child: Icon( + Icons.arrow_downward, + semanticLabel: 'Back', + size: 22, + ), + )), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: <Widget>[ + SliderTheme( + data: SliderThemeData( + thumbColor: Colors.blue, + thumbShape: RoundSliderThumbShape(enabledThumbRadius: 20), + valueIndicatorColor: Colors.white, + trackHeight: 15.0, + valueIndicatorTextStyle: TextStyle( + fontSize: 100.0, + ), + ), + child: Slider( + value: _value, + onChanged: (_newValue) => setState(() { + _value = _newValue; + }), + max: 5, + min: 0, + divisions: 5, + label: _emojify(), + ), + ) + ], + ), + ], + ), + ), + ), + ); + } + String _emojify() { + switch (_value.floor()) { + case 0: + return Demoji.heart_eyes; + case 1: + return Demoji.star_struck; + case 2: + return Demoji.smiley; + case 3: + return Demoji.sweat_smile; + case 4: + return Demoji.neutral_face; + case 5: + return Demoji.angry; + } + + return ''; + } +} diff --git a/lib/ui/entries/select_page.dart b/lib/ui/entries/select_page.dart new file mode 100644 index 0000000000000000000000000000000000000000..aa29d679faba8b857c1224ec47e07d38d5b0a37d --- /dev/null +++ b/lib/ui/entries/select_page.dart @@ -0,0 +1,492 @@ +// import 'dart:typed_data'; +import 'package:flutter_app/ui/entries/add_entries.dart'; +import 'package:flutter_app/ui/entries/image_uploader.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_app/ui/common/slide_up_route.dart'; +// import 'package:flutter_app/ui/entries/add_entries.dart'; +import 'add_emojis.dart'; +import 'package:flutter_app/ui/entries/range_slider.dart'; +import 'sensor_input.dart'; + +class Selectentries extends StatefulWidget { + @override + _SelectentriesState createState() => _SelectentriesState(); +} + +class _SelectentriesState extends State<Selectentries> { + @override + Widget build(BuildContext context) { + return Scaffold( + body: SafeArea( + child: SingleChildScrollView( + child: Stack( + children: <Widget>[ + Row( + children: [ + InkResponse( + onTap: () { + Navigator.of(context).pop(); + }, + child: Container( + padding: EdgeInsets.all(10), + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: Colors.black12), + borderRadius: BorderRadius.circular(100), + boxShadow: [ + BoxShadow( + color: Color(0xFF3C4858).withOpacity(.5), + offset: Offset(1.0, 10.0), + blurRadius: 10.0), + ], + ), + child: Icon( + Icons.arrow_downward, + semanticLabel: 'Back', + size: 22, + ), + ), + ), + ], + ), + Column( + children: <Widget>[ + GestureDetector( + onTap: () => Navigator.of(context).push(SlideUpRoute(widget: AddEntry())), + child: Container( + margin: EdgeInsets.only(bottom: 10.0, top: 10.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: <Widget>[ + SizedBox( + height: 180, + width: 200, + child: Stack( + children: <Widget>[ + Positioned( + left: 0.0, + top: 30.0, + child: Container( + width: 180, + height: 140, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10.0), + boxShadow: [ + BoxShadow( + color: Colors.black12, + offset: Offset(0.0, 0.0), + blurRadius: 10.0), + ]), + child: Padding( + padding: const EdgeInsets.all(10.0), + child: Column( + children: <Widget>[ + Text( + 'Add Diary', + maxLines: 3, + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Colors.black54, + fontWeight: FontWeight.bold, + fontSize: 20.0), + ), + Expanded( + child: Column( + mainAxisAlignment: + MainAxisAlignment.end, + children: <Widget>[ + Row( + mainAxisAlignment: + MainAxisAlignment.end, + children: <Widget>[ + Icon( + Icons.arrow_forward, + size: 26.0, + color: Colors.blueGrey, + ) + ], + ), + ], + ), + ) + ], + ), + ), + ), + ) + ], + ), + ), + ], + ), + ), + ), + // Flexible( + // flex: 2, + // child: Row( + // mainAxisAlignment: MainAxisAlignment.start, + // children: <Widget>[ + // SizedBox.fromSize( + // size: Size(120, 120), + // child: Card( + // elevation: 3.0, + // shape: Border(right: BorderSide(color: Colors.blue[500], width: 8), + // top: BorderSide(color: Colors.blue[500], width: 5), + // left: BorderSide(color: Colors.blue[500], width: 5), + // bottom: BorderSide(color: Colors.blue[500], width: 8)), + // child: Material( + // color: Colors.blue[600], + // child: InkWell( + // splashColor: Color(0xFF3C4858), + // onTap: () => Navigator.of(context).push(SlideUpRoute(widget: AddEmojis())), + // child: Column( + // mainAxisAlignment: MainAxisAlignment.center, + // children: <Widget>[ + // Icon(Icons.add, size: 80.0, color: Colors.white,), + // Text('Diary', style: TextStyle(fontSize: 16.0,fontWeight: FontWeight.bold, color: Colors.white),), + // ], + // ), + // ), + // ), + // ), + // ), + // ], + // ), + // ), + GestureDetector( + onTap: () =>Navigator.of(context).push(SlideUpRoute(widget: AddEmojis())), + child: Container( + margin: EdgeInsets.only(bottom: 10.0, top: 10.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: <Widget>[ + SizedBox( + height: 180, + width: 200, + child: Stack( + children: <Widget>[ + Positioned( + left: 0.0, + top: 30.0, + child: Container( + width: 180, + height: 140, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10.0), + boxShadow: [ + BoxShadow( + color: Colors.black12, + offset: Offset(0.0, 0.0), + blurRadius: 10.0), + ]), + child: Padding( + padding: const EdgeInsets.all(10.0), + child: Column( + children: <Widget>[ + Text( + 'Express Emotions', + maxLines: 3, + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Colors.black54, + fontWeight: FontWeight.bold, + fontSize: 20.0), + ), + Expanded( + child: Column( + mainAxisAlignment: + MainAxisAlignment.end, + children: <Widget>[ + Row( + mainAxisAlignment: + MainAxisAlignment.end, + children: <Widget>[ + Icon( + Icons.arrow_forward, + size: 26.0, + color: Colors.blueGrey, + ) + ], + ), + ], + ), + ) + ], + ), + ), + ), + ) + ], + ), + ), + ], + ), + ), + ), + // Flexible( + // flex: 2, + // child:Row( + // mainAxisAlignment: MainAxisAlignment.center, + // children: <Widget>[ + // SizedBox.fromSize( + // size: Size(140, 140), + // child: Card( + // elevation: 3.0, + // shape: Border(right: BorderSide(color: Colors.blue[500], width: 8), + // top: BorderSide(color: Colors.blue[500], width: 5), + // left: BorderSide(color: Colors.blue[500], width: 5), + // bottom: BorderSide(color: Colors.blue[500], width: 8)), + // child: Material( + // color: Colors.blue[600], + // child: InkWell( + // splashColor: Color(0xFF3C4858), + // onTap: () =>Navigator.of(context).push(SlideUpRoute(widget: AddEmojis())), + // child: Column( + // mainAxisAlignment: MainAxisAlignment.center, + // children: <Widget>[ + // Icon(Icons.emoji_emotions, size: 80.0, color: Colors.amber,), + // Text('Express Emotion', style: TextStyle(fontSize: 16.0,fontWeight: FontWeight.bold, color: Colors.white),), + // ], + // ), + // ), + // ), + // ), + // ), + // ], + // ), + // ), + GestureDetector( + onTap: () => Navigator.of(context).push(SlideUpRoute(widget: ImageUploader())), + child: Container( + margin: EdgeInsets.only(bottom: 10.0, top: 10.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: <Widget>[ + SizedBox( + height: 180, + width: 200, + child: Stack( + children: <Widget>[ + Positioned( + left: 0.0, + top: 30.0, + child: Container( + width: 180, + height: 140, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10.0), + boxShadow: [ + BoxShadow( + color: Colors.black12, + offset: Offset(0.0, 0.0), + blurRadius: 10.0), + ]), + child: Padding( + padding: const EdgeInsets.all(10.0), + child: Column( + children: <Widget>[ + Text( + 'Image Uploader', + maxLines: 3, + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Colors.black54, + fontWeight: FontWeight.bold, + fontSize: 20.0), + ), + Expanded( + child: Column( + mainAxisAlignment: + MainAxisAlignment.end, + children: <Widget>[ + Row( + mainAxisAlignment: + MainAxisAlignment.end, + children: <Widget>[ + Icon( + Icons.arrow_forward, + size: 26.0, + color: Colors.blueGrey, + ) + ], + ), + ], + ), + ) + ], + ), + ), + ), + ) + ], + ), + ), + ], + ), + ), + ), + GestureDetector( + onTap: () => Navigator.of(context).push(SlideUpRoute(widget: SensorInput())), + child: Container( + margin: EdgeInsets.only(bottom: 10.0, top: 10.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: <Widget>[ + SizedBox( + height: 180, + width: 200, + child: Stack( + children: <Widget>[ + Positioned( + left: 0.0, + top: 30.0, + child: Container( + width: 180, + height: 140, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10.0), + boxShadow: [ + BoxShadow( + color: Colors.black12, + offset: Offset(0.0, 0.0), + blurRadius: 10.0), + ]), + child: Padding( + padding: const EdgeInsets.all(10.0), + child: Column( + children: <Widget>[ + Text( + 'Sensor Input', + maxLines: 3, + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Colors.black54, + fontWeight: FontWeight.bold, + fontSize: 20.0), + ), + Expanded( + child: Column( + mainAxisAlignment: + MainAxisAlignment.end, + children: <Widget>[ + Row( + mainAxisAlignment: + MainAxisAlignment.end, + children: <Widget>[ + Icon( + Icons.arrow_forward, + size: 26.0, + color: Colors.blueGrey, + ) + ], + ), + ], + ), + ) + ], + ), + ), + ), + ) + ], + ), + ), + ], + ), + ), + ), + GestureDetector( + onTap: () => Navigator.of(context).push(SlideUpRoute(widget: StressSlider())), + child: Container( + margin: EdgeInsets.only(bottom: 10.0, top: 10.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: <Widget>[ + SizedBox( + height: 180, + width: 200, + child: Stack( + children: <Widget>[ + Positioned( + left: 0.0, + top: 30.0, + child: Container( + width: 180, + height: 140, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10.0), + boxShadow: [ + BoxShadow( + color: Colors.black12, + offset: Offset(0.0, 0.0), + blurRadius: 10.0), + ]), + child: Padding( + padding: const EdgeInsets.all(10.0), + child: Column( + children: <Widget>[ + Text( + 'Stress Slider', + maxLines: 3, + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Colors.black54, + fontWeight: FontWeight.bold, + fontSize: 20.0), + ), + Expanded( + child: Column( + mainAxisAlignment: + MainAxisAlignment.end, + children: <Widget>[ + Row( + mainAxisAlignment: + MainAxisAlignment.end, + children: <Widget>[ + Icon( + Icons.arrow_forward, + size: 26.0, + color: Colors.blueGrey, + ) + ], + ), + ], + ), + ) + ], + ), + ), + ), + ) + ], + ), + ), + ], + ), + ), + ), + ], + ), + ], + ), + ), + ), + ); + } +} + + + + + + diff --git a/lib/ui/entries/sensor_input.dart b/lib/ui/entries/sensor_input.dart new file mode 100644 index 0000000000000000000000000000000000000000..fe4ba8bd4f581367394b7ce3da059bb949f4db22 --- /dev/null +++ b/lib/ui/entries/sensor_input.dart @@ -0,0 +1,207 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:flutter_sensors/flutter_sensors.dart'; +import 'package:app_usage/app_usage.dart'; +import 'package:flutter_spinkit/flutter_spinkit.dart'; + +class SensorInput extends StatefulWidget { + @override + _SensorInputState createState() => _SensorInputState(); +} + +class _Sensor { + String name; + String unit; + int type; + bool available = false; + StreamSubscription stream = null; + List<double> data = null; + + _Sensor(name, unit, type) { + this.name = name; + this.unit = unit; + this.type = type; + } +} + +class _SensorInputState extends State<SensorInput> { + List<AppUsageInfo> _infos = []; + + List<_Sensor> _sensors = [ + _Sensor("Accelerometer", "m/s2", 1), + _Sensor("Gyroscope", "rad/s", 4), + _Sensor("Proximity", "cm", 8), + _Sensor("Motion", "m/s2", 30), + _Sensor("Humidity", "%", 12), + _Sensor("Pressure", "hPa", 6), + _Sensor("Light", "lux", 5), + _Sensor("Temperature", "°C", 13), + _Sensor("Heartrate", "bpm", 21), + _Sensor("Stepcounter", "#", 19) + ]; + + bool _measuring = false; + + @override + void initState() { + _checkSensors(); + super.initState(); + } + + @override + void dispose() { + _stopSensors(); + super.dispose(); + } + + void _startSensors() async { + _measuring = true; + + getUsageStats(); + + for (var sensor in _sensors) { + if (sensor.stream != null) return; + if (sensor.available) { + final stream = await SensorManager().sensorUpdates( + sensorId: sensor.type, + interval: Sensors.SENSOR_DELAY_FASTEST, + ); + sensor.stream = stream.listen((sensorEvent) { + setState(() { + sensor.data = sensorEvent.data; + }); + }); + } + } + } + + void _stopSensors() async { + _measuring = false; + + for (var sensor in _sensors) { + if (sensor.stream == null) return; + sensor.stream.cancel(); + sensor.stream = null; + } + ; + } + + void _checkSensors() async { + for (var sensor in _sensors) { + await SensorManager().isSensorAvailable(sensor.type).then((result) { + setState(() { + sensor.available = result; + }); + }); + } + } + + void getUsageStats() async { + try { + DateTime endDate = new DateTime.now(); + DateTime startDate = endDate.subtract(Duration(hours: 1)); + List<AppUsageInfo> infoList = + await AppUsage.getAppUsage(startDate, endDate); + setState(() { + _infos = infoList; + }); + + for (var info in infoList) { + print(info.toString()); + } + } on AppUsageException catch (exception) { + print(exception); + } + } + + List<Widget> getSensorWidgets() { + List<Widget> list = new List<Widget>(); + + list.add( + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: <Widget>[ + MaterialButton( + child: Text(_measuring ? "Stop measure" : "Start measure"), + color: _measuring ? Colors.red.shade200 : Colors.green.shade200, + onPressed: + _measuring ? () => _stopSensors() : () => _startSensors(), + ), + Padding( + padding: EdgeInsets.all(8.0), + ), + Visibility( + child: SpinKitPulse( + color: Colors.accents.first, + size: 30.0, + ), + visible: _measuring, + maintainState: true, + maintainAnimation: true, + maintainSize: true, + ) + ], + ), + ); + + for (var sensor in _sensors) + list.add(Column( + mainAxisAlignment: MainAxisAlignment.center, + children: <Widget>[ + Padding(padding: EdgeInsets.only(top: 20.0)), + Text( + sensor.name, + textAlign: TextAlign.center, + style: TextStyle( + color: sensor.available ? Colors.black : Colors.red.shade300, + fontSize: 20, + ), + ), + Padding(padding: EdgeInsets.only(top: 16.0)), + if (sensor.data != null) + for (var i = 0; i < sensor.data.length; i++) + Text( + "${sensor.unit} ($i) = ${sensor.data[i].toStringAsFixed(2)}", + textAlign: TextAlign.center, + ), + ])); + + list.add(Padding(padding: EdgeInsets.only(top: 20.0))); + list.add(Text("App Usage", + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.black, + fontSize: 20, + ))); + list.add(Padding(padding: EdgeInsets.only(top: 16.0))); + + for (var item in _infos) { + list.add(ListTile( + title: Text( + item.appName, + textAlign: TextAlign.center, + ), + trailing: Text(item.usage.inMinutes.toString()))); + } + return list; + } + + // ### View ### + + @override + Widget build(BuildContext context) { + return MaterialApp( + home: Scaffold( + appBar: AppBar( + title: const Text('Sensor Data'), + ), + body: Container( + padding: EdgeInsets.all(16.0), + alignment: AlignmentDirectional.topCenter, + child: ListView(children: getSensorWidgets()), + ), + ), + ); + } +} diff --git a/lib/ui/home.dart b/lib/ui/home.dart new file mode 100644 index 0000000000000000000000000000000000000000..e4bf6ae946e2cce93c1489aedecb57ecb7786683 --- /dev/null +++ b/lib/ui/home.dart @@ -0,0 +1,56 @@ +// import 'package:flutter/material.dart'; +// import 'package:flutter_app/ui/entries/select_page.dart'; +// import 'package:flutter_app/ui/common/slide_up_route.dart'; +// import 'package:flutter_app/ui/entries/list_entries.dart'; +// import 'package:flutter_app/ui/profile/profile.dart'; +// +// +// +// class Home extends StatefulWidget { +// static const routeName = 'home'; +// +// @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( +// body: IndexedStack( +// index: _currentIndex, +// 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; +// }); +// } +// } +// diff --git a/lib/ui/root.dart b/lib/ui/root.dart new file mode 100644 index 0000000000000000000000000000000000000000..654636a7ad102ab7bb21e544275664cd64e317a8 --- /dev/null +++ b/lib/ui/root.dart @@ -0,0 +1,35 @@ +// import 'package:flutter_app/utils/auth_helper.dart'; +// import 'package:flutter/material.dart'; +// import 'home.dart'; +// import '../main.dart'; +// import 'intro/intro.dart'; +// +// class Root extends StatefulWidget { +// @override +// _RootState createState() => _RootState(); +// } +// +// class _RootState extends State<Root> { +// var _authStatus; +// +// @override +// void initState() { +// super.initState(); +// // getAuthStatus(); +// } +// +// // void getAuthStatus() async { +// // final authStatus = await AuthHelper.isAuth(); +// // setState(() { +// // _authStatus = authStatus; +// // }); +// // } +// +// @override +// Widget build(BuildContext context) { +// // if(_authStatus == AuthStatus.LOGGED_IN){ +// // return Home(); +// // } +// // return Intro(); +// } +// } \ No newline at end of file diff --git a/lib/ui/wrapper/wrapper.dart b/lib/ui/wrapper/wrapper.dart new file mode 100644 index 0000000000000000000000000000000000000000..a47f241e324bbcaa46d5a957545ed1296a1dc307 --- /dev/null +++ b/lib/ui/wrapper/wrapper.dart @@ -0,0 +1 @@ +import 'package:flutter/material.dart'; diff --git a/lib/utils/input_validator.dart b/lib/utils/input_validator.dart new file mode 100644 index 0000000000000000000000000000000000000000..fb4174f04b21dce9f34c25273fea97a320ae1ed9 --- /dev/null +++ b/lib/utils/input_validator.dart @@ -0,0 +1,15 @@ + +class InputValidator { + static String title(String value) { + if (value.isEmpty) { + return 'C\'mon, give me a headline!'; + } + return null; + } + static String content(String value) { + if (value.isEmpty) { + return 'Hey! You haven\'t told me anything yet!'; + } + return null; + } +} diff --git a/pubspec.lock b/pubspec.lock index b7fc4d54486d14d34ec3c960f61d3f06f776061d..071c2e595be10a26cbf22d79d5ed7b758980c685 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,48 +1,97 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + app_usage: + dependency: "direct main" + description: + name: app_usage + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0-nullsafety.1" + version: "2.5.0" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0" + cached_network_image: + dependency: "direct dev" + description: + name: cached_network_image + url: "https://pub.dartlang.org" + source: hosted + version: "2.3.3" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.3" + version: "1.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0" + cloud_firestore: + dependency: "direct main" + description: + name: cloud_firestore + url: "https://pub.dartlang.org" + source: hosted + version: "0.14.4" + cloud_firestore_platform_interface: + dependency: transitive + description: + name: cloud_firestore_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.1" + cloud_firestore_web: + dependency: transitive + description: + name: cloud_firestore_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.1+2" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0-nullsafety.3" + version: "1.15.0" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" + crypto: + dependency: transitive + description: + name: crypto + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.5" cupertino_icons: dependency: "direct main" description: @@ -50,18 +99,123 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.0" + demoji: + dependency: "direct main" + description: + name: demoji + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" + dio: + dependency: "direct dev" + description: + name: dio + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.10" + email_validator: + dependency: "direct dev" + description: + name: email_validator + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.6" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" + ffi: + dependency: transitive + description: + name: ffi + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.3" + file: + dependency: transitive + description: + name: file + url: "https://pub.dartlang.org" + source: hosted + version: "5.2.1" + firebase_auth: + dependency: "direct main" + description: + name: firebase_auth + url: "https://pub.dartlang.org" + source: hosted + version: "0.18.4+1" + firebase_auth_platform_interface: + dependency: transitive + description: + name: firebase_auth_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.4" + firebase_auth_web: + dependency: transitive + description: + name: firebase_auth_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.2+3" + firebase_core: + dependency: "direct main" + description: + name: firebase_core + url: "https://pub.dartlang.org" + source: hosted + version: "0.5.3" + firebase_core_platform_interface: + dependency: transitive + description: + name: firebase_core_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" + firebase_core_web: + dependency: transitive + description: + name: firebase_core_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.1+1" + firebase_database: + dependency: "direct main" + description: + name: firebase_database + url: "https://pub.dartlang.org" + source: hosted + version: "4.4.0" flutter: dependency: "direct main" description: flutter source: sdk version: "0.0.0" + flutter_blurhash: + dependency: transitive + description: + name: flutter_blurhash + url: "https://pub.dartlang.org" + source: hosted + version: "0.5.0" + flutter_cache_manager: + dependency: "direct dev" + description: + name: flutter_cache_manager + url: "https://pub.dartlang.org" + source: hosted + version: "1.4.2" + flutter_plugin_android_lifecycle: + dependency: transitive + description: + name: flutter_plugin_android_lifecycle + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.11" flutter_sensors: dependency: "direct main" description: @@ -69,32 +223,247 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.1.6" + flutter_spinkit: + dependency: "direct main" + description: + name: flutter_spinkit + url: "https://pub.dartlang.org" + source: hosted + version: "4.1.2+1" flutter_test: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + get_it: + dependency: "direct dev" + description: + name: get_it + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.0" + google_sign_in: + dependency: "direct main" + description: + name: google_sign_in + url: "https://pub.dartlang.org" + source: hosted + version: "4.5.9" + google_sign_in_platform_interface: + dependency: transitive + description: + name: google_sign_in_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.2" + google_sign_in_web: + dependency: transitive + description: + name: google_sign_in_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.9.2" + http: + dependency: transitive + description: + name: http + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.2" + http_parser: + dependency: transitive + description: + name: http_parser + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.4" + image_picker: + dependency: "direct main" + description: + name: image_picker + url: "https://pub.dartlang.org" + source: hosted + version: "0.6.7+22" + image_picker_platform_interface: + dependency: transitive + description: + name: image_picker_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.6" + intl: + dependency: "direct dev" + description: + name: intl + url: "https://pub.dartlang.org" + source: hosted + version: "0.16.1" + js: + dependency: transitive + description: + name: js + url: "https://pub.dartlang.org" + source: hosted + version: "0.6.3" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10-nullsafety.1" + version: "0.12.10" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0" + octo_image: + dependency: transitive + description: + name: octo_image + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.1" + version: "1.8.0" + path_provider: + dependency: "direct main" + description: + name: path_provider + url: "https://pub.dartlang.org" + source: hosted + version: "1.6.27" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.1+2" + path_provider_macos: + dependency: transitive + description: + name: path_provider_macos + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.4+8" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.4" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.4+3" + pedantic: + dependency: transitive + description: + name: pedantic + url: "https://pub.dartlang.org" + source: hosted + version: "1.9.2" + platform: + dependency: transitive + description: + name: platform + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.1" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.3" + process: + dependency: transitive + description: + name: process + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.13" + provider: + dependency: "direct dev" + description: + name: provider + url: "https://pub.dartlang.org" + source: hosted + version: "3.2.0" + quiver: + dependency: transitive + description: + name: quiver + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.5" + rxdart: + dependency: transitive + description: + name: rxdart + url: "https://pub.dartlang.org" + source: hosted + version: "0.24.1" + shared_preferences: + dependency: "direct dev" + description: + name: shared_preferences + url: "https://pub.dartlang.org" + source: hosted + version: "0.5.12+4" + shared_preferences_linux: + dependency: transitive + description: + name: shared_preferences_linux + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.2+4" + shared_preferences_macos: + dependency: transitive + description: + name: shared_preferences_macos + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.1+11" + shared_preferences_platform_interface: + dependency: transitive + description: + name: shared_preferences_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.4" + shared_preferences_web: + dependency: transitive + description: + name: shared_preferences_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.2+7" + shared_preferences_windows: + dependency: transitive + description: + name: shared_preferences_windows + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.2+3" sky_engine: dependency: transitive description: flutter @@ -106,55 +475,98 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.2" + version: "1.8.0" + sqflite: + dependency: "direct main" + description: + name: sqflite + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.2+4" + sqflite_common: + dependency: transitive + description: + name: sqflite_common + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.3+1" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.1" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0" + synchronized: + dependency: transitive + description: + name: synchronized + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.0+2" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19-nullsafety.2" + version: "0.2.19" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0" + uuid: + dependency: transitive + description: + name: uuid + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.2" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.3" + version: "2.1.0" + win32: + dependency: transitive + description: + name: win32 + url: "https://pub.dartlang.org" + source: hosted + version: "1.7.4+1" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.2" sdks: - dart: ">=2.10.0-110 <2.11.0" + dart: ">=2.12.0-0.0 <3.0.0" + flutter: ">=1.22.2" diff --git a/pubspec.yaml b/pubspec.yaml index 9e0addb293907cb1a4bc9ad11e1503b94ee73b68..551dc0e61cd442a7c9a0cb830b74c9307df67283 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -31,11 +31,37 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.0 +# file_picker: ^2.1.7 + image_picker: ^0.6.7+22 + demoji: ^1.0.1 + sqflite: ^1.2.0 + path_provider: ^1.5.1 + firebase_auth: ^0.18.4+1 + google_sign_in: ^4.4.4 + cloud_firestore: ^0.14.4 + firebase_database: 4.4.0 + firebase_core: ^0.5.0 + flutter_sensors: ^0.1.6 + app_usage: ^1.2.0 + flutter_spinkit: "^4.1.2" + dev_dependencies: flutter_test: sdk: flutter + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cached_network_image: ^2.0.0-rc +# cupertino_icons: ^0.1.2 + dio: ^3.0.6 + email_validator: ^1.0.0 + flutter_cache_manager: ^1.1.3 + get_it: ^3.0.3 + provider: ^3.0.0+1 + shared_preferences: ^0.5.3+4 + intl: ^0.16.0 + # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec @@ -48,7 +74,15 @@ flutter: uses-material-design: true # To add assets to your application, add an assets section, like this: - # assets: + assets: + - images/ + - assets/images/emoticon-very-sad.png + - assets/images/emoticon-happy.png + - assets/images/emoticon-angry.png + - assets/images/emoticon-sleepy.png + - assets/images/emoticon-tired.png + - assets/images/emoticon-motivated.png + - assets/images/emoticon-bored.png # - images/a_dot_burr.jpeg # - images/a_dot_ham.jpeg diff --git a/test/widget_test.dart b/test/widget_test.dart index 5e7d4e8420bd5a02d247b8d0888d06a5b2fa3da7..d54543d7a14fe3c8305b548109c2b1c8a33dc012 100644 --- a/test/widget_test.dart +++ b/test/widget_test.dart @@ -5,26 +5,26 @@ // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import 'package:flutter_app/main.dart'; - -void main() { - testWidgets('Counter increments smoke test', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.pumpWidget(MyApp()); - - // Verify that our counter starts at 0. - expect(find.text('0'), findsOneWidget); - expect(find.text('1'), findsNothing); - - // Tap the '+' icon and trigger a frame. - await tester.tap(find.byIcon(Icons.add)); - await tester.pump(); - - // Verify that our counter has incremented. - expect(find.text('0'), findsNothing); - expect(find.text('1'), findsOneWidget); - }); -} +// import 'package:flutter/material.dart'; +// import 'package:flutter_test/flutter_test.dart'; +// +// import 'package:flutter_app/main.dart'; +// +// void main() { +// testWidgets('Counter increments smoke test', (WidgetTester tester) async { +// // Build our app and trigger a frame. +// await tester.pumpWidget(MyApp()); +// +// // Verify that our counter starts at 0. +// expect(find.text('0'), findsOneWidget); +// expect(find.text('1'), findsNothing); +// +// // Tap the '+' icon and trigger a frame. +// await tester.tap(find.byIcon(Icons.add)); +// await tester.pump(); +// +// // Verify that our counter has incremented. +// expect(find.text('0'), findsNothing); +// expect(find.text('1'), findsOneWidget); +// }); +// }