From 92b04226f63069ee892d61b9ff65ff68709e6ff6 Mon Sep 17 00:00:00 2001 From: elblogbruno Date: Mon, 15 Feb 2021 11:45:41 +0100 Subject: [PATCH] feat: Initial Android and Ios Flutte App --- .gitignore | 5 + .../android/app/build.gradle | 19 +- .../android/app/src/main/AndroidManifest.xml | 3 +- .../notion_ai_my_mind/lib/Arguments.dart | 5 + .../notion_ai_my_mind/lib/api/api.dart | 160 +++++++++++----- .../notion_ai_my_mind/lib/main.dart | 171 +++++++++++++----- .../notion_ai_my_mind/lib/overlay_view.dart | 55 ++++-- .../lib/resources/strings.dart | 5 +- .../notion_ai_my_mind/lib/settings.dart | 34 ++-- .../notion_ai_my_mind/pubspec.lock | 59 ++++-- .../notion_ai_my_mind/pubspec.yaml | 1 + 11 files changed, 353 insertions(+), 164 deletions(-) create mode 100644 flutter-android-ios-app/notion_ai_my_mind/lib/Arguments.dart diff --git a/.gitignore b/.gitignore index d51a5e3..7793aeb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,14 @@ # Created by https://www.toptal.com/developers/gitignore/api/images,video # Edit at https://www.toptal.com/developers/gitignore?templates=images,video + +*.jks +key.properties + /Python Server/app/.idea /Python Server/app/image_tagging/temp_image_folder /Python Server/app/__pycache__ + *.zip *.log *.json diff --git a/flutter-android-ios-app/notion_ai_my_mind/android/app/build.gradle b/flutter-android-ios-app/notion_ai_my_mind/android/app/build.gradle index 21728a4..c02693f 100644 --- a/flutter-android-ios-app/notion_ai_my_mind/android/app/build.gradle +++ b/flutter-android-ios-app/notion_ai_my_mind/android/app/build.gradle @@ -21,6 +21,12 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } +def keystoreProperties = new Properties() +def keystorePropertiesFile = rootProject.file('key.properties') +if (keystorePropertiesFile.exists()) { + keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) +} + apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" @@ -40,16 +46,23 @@ android { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.elblogbruno.notion_ai_my_mind" minSdkVersion 16 - targetSdkVersion 28 + targetSdkVersion 29 versionCode flutterVersionCode.toInteger() versionName flutterVersionName } - + signingConfigs { + release { + keyAlias keystoreProperties['keyAlias'] + keyPassword keystoreProperties['keyPassword'] + storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null + storePassword keystoreProperties['storePassword'] + } + } buildTypes { release { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.debug + signingConfig signingConfigs.release } } } diff --git a/flutter-android-ios-app/notion_ai_my_mind/android/app/src/main/AndroidManifest.xml b/flutter-android-ios-app/notion_ai_my_mind/android/app/src/main/AndroidManifest.xml index 5ef87eb..2162422 100644 --- a/flutter-android-ios-app/notion_ai_my_mind/android/app/src/main/AndroidManifest.xml +++ b/flutter-android-ios-app/notion_ai_my_mind/android/app/src/main/AndroidManifest.xml @@ -6,6 +6,7 @@ In most cases you can leave this as-is, but you if you want to provide additional functionality it is fine to subclass or reimplement FlutterApplication and put your custom class here. --> + getMindUrl() async { @@ -30,37 +33,82 @@ class Api { try { RegExp exp = new RegExp(r'(?:(?:https?|ftp):\/\/)?[\w/\-?=%.]+\.[\w/\-?=%.]+'); Iterable matches = exp.allMatches(urlToAdd); - + print(matches.length); if (matches == null) { - print("No match"); + } else { - final matchedText = matches.elementAt(1).group(0); - print("Match: " + matchedText); // my - - String title = matchedText + " added to your mind from Phone"; - String _serverUrl = await getServerUrl(); - String finalUrl = _serverUrl + "add_url_to_mind?url="+matchedText+"&title="+title; - print("Final sharing url: " + finalUrl); - http.Response response = await http.get(finalUrl); - - if (response.statusCode == 200) { - return "200"; - } else { - return '-1'; - } + if(matches.length == 0) //means no url extracted on the text. it is just text. + { + String title = "unknown url added to your mind from Phone"; + String _serverUrl = await getServerUrl(); + String finalUrl = _serverUrl + "add_text_to_mind?url=" + title + "&text=" + urlToAdd; + print("Final sharing url: " + finalUrl); + http.Response response = await http.get(finalUrl); + + if (response.statusCode == 200) { + return '200'; + } else { + return '-1'; + } + } + else if(urlToAdd == matches.first.group(0)) { + print(matches.first.group(0)); + + final matchedText = matches.first.group(0); + print("Match: " + matchedText); // my + + String title = matchedText + " added to your mind from Phone"; + String _serverUrl = await getServerUrl(); + String finalUrl = _serverUrl + "add_url_to_mind?url=" + matchedText + "&title=" + title; + print("Final sharing url: " + finalUrl); + http.Response response = await http.get(finalUrl); + + + if (response.statusCode == 200) { + return '200'; + } else { + return '-1'; + } + }else{ + print(matches.first.group(0)); + + final matchedText = matches.first.group(0); + print("Match: " + matchedText); // my + + String _serverUrl = await getServerUrl(); + String finalUrl = _serverUrl + "add_text_to_mind?url=" + matchedText + "&text=" + urlToAdd; + + print("Final sharing url: " + finalUrl); + http.Response response = await http.get(finalUrl); + + if (response.statusCode == 200) { + return '200'; + } else { + return '-1'; + } + } + } - } catch (_) { - return 'error'; + } catch (e) { + + Fluttertoast.showToast(msg: "Error: $e", + toastLength: Toast.LENGTH_SHORT, + gravity: ToastGravity.BOTTOM); + + return '-1'; } } Future addImageToMind(String urlToAdd) async { try { + String title = urlToAdd + " added to your mind from Phone"; String _serverUrl = await getServerUrl(); String finalUrl = _serverUrl + "add_image_to_mind?url="+urlToAdd+"&image_src="+title+"&image_src_url="+title; + print("Final sharing url: " + finalUrl); + http.Response response = await http.get(finalUrl); if (response.statusCode == 200) { @@ -73,22 +121,10 @@ class Api { } } - setServerUrl(String value) async { - final SharedPreferences prefs = await SharedPreferences.getInstance(); - await prefs.setString("url", value); - } - - - Future getServerUrl() async { - final SharedPreferences prefs = await SharedPreferences.getInstance(); - return prefs.getString("url") ?? 'name'; - } - - Future uploadImage(File imageFile) async { var stream = new http.ByteStream(DelegatingStream.typed(imageFile.openRead())); - /*var length = await imageFile.length(); + var length = await imageFile.length(); String _serverUrl = await getServerUrl(); String uploadURL = _serverUrl + "upload_file"; @@ -108,36 +144,60 @@ class Api { return '200'; } else { return '-1'; - }*/ + } } Future addContentToMind(String url,bool isImage) async{ - - addUrlToMind(url).then((String result){ - print(result); - return result; - }); - /*if(url != null){ + print("addContentToMind: " + url + " " + isImage.toString()); + String response = "Content is invalid or no content was added"; + if(url != null){ print("Widget url: " + url); - if(isImage){ print("Widget is image"); var myFile = new File(url); - uploadImage(myFile).then((String result){ - print(result); - return result; - }); + return uploadImage(myFile); }else{ print("Widget is url"); - addUrlToMind(url).then((String result){ - print(result); - return result; - }); + return addUrlToMind(url); } }else{ - print("Widget url is null"); - }*/ + return response; + } + } + + + setServerUrl(String value) async { + final SharedPreferences prefs = await SharedPreferences.getInstance(); + + if (value[value.length-1] != "/"){ + value = value + "/"; + } + + await prefs.setString("url", value); + } + + + Future getServerUrl() async { + final SharedPreferences prefs = await SharedPreferences.getInstance(); + return prefs.getString("url") ?? 'name'; + } + + + - return "Content is invalid or no content was added"; + launchSettings() async { + String _serverUrl = await getServerUrl(); + launchURL(_serverUrl); + } + launchRepo() async { + launchURL("https://github.com/elblogbruno/NotionAI-MyMind"); + } + + launchURL(String url) async { + if (await canLaunch(url)) { + await launch(url); + } else { + throw 'Could not launch $url'; + } } } \ No newline at end of file diff --git a/flutter-android-ios-app/notion_ai_my_mind/lib/main.dart b/flutter-android-ios-app/notion_ai_my_mind/lib/main.dart index 55f31cd..4d9d349 100644 --- a/flutter-android-ios-app/notion_ai_my_mind/lib/main.dart +++ b/flutter-android-ios-app/notion_ai_my_mind/lib/main.dart @@ -1,27 +1,23 @@ -import 'dart:convert'; import 'dart:async'; -import 'dart:io'; -import 'dart:typed_data'; import 'dart:ui'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:fluttertoast/fluttertoast.dart'; +import 'package:notion_ai_my_mind/Arguments.dart'; + import 'package:notion_ai_my_mind/overlay_view.dart'; import 'package:notion_ai_my_mind/resources/strings.dart'; import 'package:notion_ai_my_mind/settings.dart'; -import 'dart:async'; - import 'package:receive_sharing_intent/receive_sharing_intent.dart'; import 'package:rxdart/rxdart.dart'; -import 'package:shared_preferences/shared_preferences.dart'; + import 'package:webview_flutter/webview_flutter.dart'; import 'package:notion_ai_my_mind/api/api.dart'; -import 'package:device_info/device_info.dart'; + import 'package:flutter_local_notifications/flutter_local_notifications.dart'; -import 'package:path_provider/path_provider.dart'; import 'package:rxdart/subjects.dart'; import 'package:timezone/data/latest.dart' as tz; import 'package:timezone/timezone.dart' as tz; @@ -54,7 +50,7 @@ class ReceivedNotification { final String payload; } - +final GlobalKey navigatorKey = new GlobalKey(); String selectedNotificationPayload; bool isSharing = false; @@ -101,16 +97,17 @@ Future main() async { }); String initialRoute = MyHomePage.routeName; - if(isSharing){ + /*if(isSharing){ initialRoute = AddLinkPage.routeName; - } + }*/ + runApp( MaterialApp( + navigatorKey: navigatorKey, theme: ThemeData(primarySwatch: Colors.teal, accentColor: Color(0xFFDD5237)), - initialRoute: initialRoute, - routes: { - MyHomePage.routeName: (_) => MyHomePage(notificationAppLaunchDetails), - AddLinkPage.routeName: (_) => AddLinkPage() + home: MyHomePage(notificationAppLaunchDetails), + routes: { + '/add': (BuildContext context) => AddLinkPage(), }, ), ); @@ -158,8 +155,7 @@ class _MyAppState extends State with WidgetsBindingObserver { WidgetsBinding.instance.addObserver(this); } - void _initShareIntent() - { + void _initShareIntent() { // For sharing images coming from outside the app while the app is in the memory _intentDataStreamSubscription = ReceiveSharingIntent.getMediaStream() .listen((List value) { @@ -172,15 +168,15 @@ class _MyAppState extends State with WidgetsBindingObserver { if(_sharedFiles != null) { String uri = (_sharedFiles?.map((f) => f.path)?.join(",") ?? ""); if (uri != null) { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - AddLinkPage(url: uri, isImage: true,), - )); + navigatorKey.currentState.pushNamed('/add', arguments: Arguments(uri,true)); } } + setState(() { + _sharedFiles = null; + isSharing = true; + }); + }, onError: (err) { print("getIntentDataStream error: $err"); }); @@ -189,22 +185,22 @@ class _MyAppState extends State with WidgetsBindingObserver { ReceiveSharingIntent.getInitialMedia().then((List value) { setState(() { _sharedFiles = value; - isSharing = true; + isSharing = false; }); if(_sharedFiles != null) { String uri = (_sharedFiles?.map((f) => f.path)?.join(",") ?? ""); if (uri != null) { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - AddLinkPage(url: uri, isImage: true,), - )); + navigatorKey.currentState.pushNamed('/add', arguments: Arguments(uri,true)); } } + setState(() { + _sharedFiles = null; + isSharing = false; + }); + }); // For sharing or opening urls/text coming from outside the app while the app is in the memory @@ -216,24 +212,30 @@ class _MyAppState extends State with WidgetsBindingObserver { }); if(_sharedText != null) { + print("Main activity: " + _sharedText); + Fluttertoast.showToast(msg: "shared: $_sharedText", toastLength: Toast.LENGTH_SHORT, gravity: ToastGravity.BOTTOM); - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - AddLinkPage(url: _sharedText, isImage: false,), - )); + navigatorKey.currentState.pushNamed('/add', arguments: Arguments(_sharedText,false)); + + }else{ + print("Main activity: is null"); } + setState(() { + _sharedText = null; + }); + }, onError: (err) { Fluttertoast.showToast(msg: "getLinkStream error: $err", toastLength: Toast.LENGTH_SHORT, gravity: ToastGravity.BOTTOM); print("getLinkStream error: $err"); }); + + // For sharing or opening urls/text coming from outside the app while the app is closed ReceiveSharingIntent.getInitialText().then((String value) { setState(() { @@ -241,21 +243,24 @@ class _MyAppState extends State with WidgetsBindingObserver { isSharing = true; }); - if(_sharedText != null) { - Fluttertoast.showToast(msg: "shared when closed: $_sharedText", + if (_sharedText != null) { + print("Main activity app closed: " + _sharedText); + + Fluttertoast.showToast(msg: "Shared when closed: $_sharedText", toastLength: Toast.LENGTH_SHORT, gravity: ToastGravity.BOTTOM); - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - AddLinkPage(url: _sharedText, isImage: false,), - )); + navigatorKey.currentState.pushNamed('/add', arguments: Arguments(_sharedText,false)); + }else{ + print("Main activity app closed: is null"); } + setState(() { + _sharedText = null; + }); }); } + void _requestPermissions() { flutterLocalNotificationsPlugin .resolvePlatformSpecificImplementation< @@ -294,7 +299,7 @@ class _MyAppState extends State with WidgetsBindingObserver { void _configureSelectNotificationSubject() { selectNotificationSubject.stream.listen((String payload) async { - await Navigator.pushNamed(context, '/secondPage'); + //await Navigator.pushNamed(context, '/secondPage'); }); } @@ -302,11 +307,15 @@ class _MyAppState extends State with WidgetsBindingObserver { void didChangeAppLifecycleState(AppLifecycleState state) { if(state == AppLifecycleState.resumed){ print("App resumed"); + Fluttertoast.showToast(msg: "App resumed", toastLength: Toast.LENGTH_SHORT, gravity: ToastGravity.BOTTOM); }else if(state == AppLifecycleState.inactive){ print("App Inactive"); + setState(() { + isSharing = false; + }); Fluttertoast.showToast(msg: "App Inactive", toastLength: Toast.LENGTH_SHORT, gravity: ToastGravity.BOTTOM); @@ -346,6 +355,7 @@ class _MyAppState extends State with WidgetsBindingObserver { 0, null, 'Your mind loaded succesfully!', platformChannelSpecifics, payload: 'item x'); } + Future _onContentAdded() async { const AndroidNotificationDetails androidPlatformChannelSpecifics = AndroidNotificationDetails( @@ -360,6 +370,7 @@ class _MyAppState extends State with WidgetsBindingObserver { 0, null, 'Added to your mind.', platformChannelSpecifics, payload: 'item x'); } + Future _onContentError() async { const AndroidNotificationDetails androidPlatformChannelSpecifics = AndroidNotificationDetails( @@ -394,7 +405,7 @@ class _MyAppState extends State with WidgetsBindingObserver { builder: (BuildContext context, AsyncSnapshot snapshot) { List children; if (snapshot.hasData) { - return _BuildWebView(context,snapshot.data); + return _buildButtons(context,snapshot.data); } else if (snapshot.hasError) { children = [ Icon( @@ -416,7 +427,7 @@ class _MyAppState extends State with WidgetsBindingObserver { ), const Padding( padding: EdgeInsets.only(top: 16), - child: Text('Awaiting result...'), + child: Text(Strings.waitText), ) ]; } @@ -448,7 +459,7 @@ class _MyAppState extends State with WidgetsBindingObserver { MaterialPageRoute(builder: (context) => settings()), ); }, - tooltip: 'Increment', + tooltip: 'Settings', child: Icon(Icons.settings), focusColor: Colors.red, elevation: 3.0, @@ -459,7 +470,69 @@ class _MyAppState extends State with WidgetsBindingObserver { ); } - Widget _BuildWebView(BuildContext context,String url){ + Widget _buildButtons(BuildContext context,String url) { + return new Scaffold( + body: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: 25), + new Text('Welcome to your mind!',textAlign: TextAlign.center, + overflow: TextOverflow.visible, + style: TextStyle(fontWeight: FontWeight.bold,fontSize: 30)), + SizedBox(height: 50), + ButtonTheme( + minWidth: 200.0, + height: 100.0, + child: RaisedButton( + onPressed:() => Api().launchURL(url), + splashColor: Color(0xFFDD5237), + color: Colors.teal, + child: new Text( + "Open Your Mind", + style: new TextStyle(fontSize: 20.0, color: Colors.white), + ), + ), + ), + SizedBox(height: 30), + ButtonTheme( + minWidth: 200.0, + height: 100.0, + child: RaisedButton( + onPressed:() => Api().launchSettings(), + splashColor: Color(0xFFDD5237), + color: Colors.teal, + child: new Text( + "Open Server Settings", + style: new TextStyle(fontSize: 20.0, color: Colors.white), + ), + ), + ), + SizedBox(height: 50), + new Text('Made with love by @elblogbruno! Have any problem or feedback? Post an issue!', textAlign: TextAlign.center, + overflow: TextOverflow.visible, + style: TextStyle(fontWeight: FontWeight.bold,fontSize: 20)), + SizedBox(height: 10), + new RaisedButton( + onPressed:() => Api().launchRepo(), + splashColor: Color(0xFFDD5237), + color: Colors.teal, + child: new Text( + "Open Github Repo", + style: new TextStyle(fontSize: 20.0, color: Colors.white), + ), + ), + + ], + ) + ), + ); + } + + + Widget _buildWebView(BuildContext context,String url){ return new WebView( initialUrl: url, javascriptMode: JavascriptMode.unrestricted, diff --git a/flutter-android-ios-app/notion_ai_my_mind/lib/overlay_view.dart b/flutter-android-ios-app/notion_ai_my_mind/lib/overlay_view.dart index 7315bee..9011cc1 100644 --- a/flutter-android-ios-app/notion_ai_my_mind/lib/overlay_view.dart +++ b/flutter-android-ios-app/notion_ai_my_mind/lib/overlay_view.dart @@ -1,40 +1,31 @@ import 'dart:io'; import 'package:flutter/material.dart'; +import 'package:notion_ai_my_mind/Arguments.dart'; +import 'package:notion_ai_my_mind/main.dart'; import 'package:notion_ai_my_mind/resources/strings.dart'; +import 'package:fluttertoast/fluttertoast.dart'; import 'api/api.dart'; -class AddLinkPage extends StatefulWidget { +class AddLinkPage extends StatelessWidget { static const String routeName = '/add'; - final String url; - final bool isImage; - AddLinkPage({Key key, this.url,this.isImage}) : super(key: key); - - @override - State createState() => _ShowUrlState(); -} - -class _ShowUrlState extends State { - - Future status; - - //Future _calculation = Api().addContentToMind(widget.url,widget.isImage); @override Widget build(BuildContext context) { + final Arguments args = ModalRoute.of(context).settings.arguments; return Scaffold( appBar: AppBar( title: const Text(Strings.titleAddNewLinkPage), ), body: FutureBuilder( - future: Api().addContentToMind(widget.url,widget.isImage), // a previously-obtained Future or null + future: Api().addContentToMind(args.url,args.isImage), // a previously-obtained Future or null builder: (BuildContext context, AsyncSnapshot snapshot) { List children; if (snapshot.hasData) { - return _buildText(context,snapshot.data,true); + return _buildText(context,snapshot.data.toString(), snapshot.data == '-1'); } else if (snapshot.hasError) { - return _buildText(context,snapshot.error.toString(),false); + return _buildText(context,snapshot.error.toString(), true); } else { children = [ SizedBox( @@ -44,7 +35,7 @@ class _ShowUrlState extends State { ), const Padding( padding: EdgeInsets.only(top: 16), - child: Text('Awaiting result...'), + child: Text(Strings.waitText), ) ]; } @@ -62,6 +53,9 @@ class _ShowUrlState extends State { Widget _buildText(BuildContext context,String text,bool error) { List children; + if(text == '200'){ + text = Strings.goodResultResponse; + } if(error){ children = [ Icon( @@ -71,7 +65,17 @@ class _ShowUrlState extends State { ), Padding( padding: const EdgeInsets.only(top: 16), - child: Text(text,textScaleFactor: 3,), + child: Text(text,textAlign: TextAlign.center ,style: new TextStyle(fontSize: 20.0, color: Colors.black)), + ), + SizedBox(height: 50), + RaisedButton( + onPressed:()=> Navigator.of(context).pop(), + splashColor: Color(0xFFDD5237), + color: Colors.teal, + child: new Text( + Strings.exitButtonText, + style: new TextStyle(fontSize: 20.0, color: Colors.white), + ), ) ]; }else{ @@ -83,10 +87,21 @@ class _ShowUrlState extends State { ), Padding( padding: const EdgeInsets.only(top: 16), - child: Text(text,textScaleFactor: 3,), + child: Text(text,textAlign: TextAlign.center ,style: new TextStyle(fontSize: 20.0, color: Colors.black)), + ), + SizedBox(height: 50), + RaisedButton( + onPressed:()=> Navigator.of(context).pop(), + splashColor: Color(0xFFDD5237), + color: Colors.teal, + child: new Text( + Strings.exitButtonText, + style: new TextStyle(fontSize: 20.0, color: Colors.white), + ), ) ]; } + return Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, diff --git a/flutter-android-ios-app/notion_ai_my_mind/lib/resources/strings.dart b/flutter-android-ios-app/notion_ai_my_mind/lib/resources/strings.dart index e24bfb9..1977e57 100644 --- a/flutter-android-ios-app/notion_ai_my_mind/lib/resources/strings.dart +++ b/flutter-android-ios-app/notion_ai_my_mind/lib/resources/strings.dart @@ -1,5 +1,8 @@ class Strings { static const title = 'Notion AI My Mind'; static const titleAddNewLinkPage = 'Add new link'; - + static const goodResultResponse = 'Added to your mind.'; + static const exitButtonText = 'Ok.'; + static const waitText = 'Awaiting result...'; + static const badResultResponse = 'Content could not be added to your mind.'; } \ No newline at end of file diff --git a/flutter-android-ios-app/notion_ai_my_mind/lib/settings.dart b/flutter-android-ios-app/notion_ai_my_mind/lib/settings.dart index 6e39bfe..d989039 100644 --- a/flutter-android-ios-app/notion_ai_my_mind/lib/settings.dart +++ b/flutter-android-ios-app/notion_ai_my_mind/lib/settings.dart @@ -8,24 +8,7 @@ import 'api/api.dart'; class settings extends StatelessWidget { @override Widget build(BuildContext context) { - return new MaterialApp( - title: 'Flutter Demo', - theme: new ThemeData( - // This is the theme of your application. - // - // Try running your application with "flutter run". You'll see the - // application has a blue toolbar. Then, without quitting the app, try - // changing the primarySwatch below to Colors.green and then invoke - // "hot reload" (press "r" in the console where you ran "flutter run", - // or press Run > Flutter Hot Reload in IntelliJ). Notice that the - // counter didn't reset back to zero; the application is not restarted. - primarySwatch: Colors.blue, - //primaryColor: Colors.red, - //backgroundColor: Colors.white, - //bottomAppBarColor: Colors.white, - ), - home: new settingsPage(), - ); + return new settingsPage(); } } class settingsPage extends StatefulWidget { @@ -71,11 +54,19 @@ class settingsState extends State { }, controller: myController, ), + SizedBox(height: 50), + Text( + "Current url: ", + textAlign: TextAlign.center, + overflow: TextOverflow.ellipsis, + style: TextStyle(fontWeight: FontWeight.bold,fontSize: 35), + ), + SizedBox(height: 20), Text( - "Current url: " + _textFromFile, + _textFromFile, textAlign: TextAlign.center, overflow: TextOverflow.ellipsis, - style: TextStyle(fontWeight: FontWeight.bold), + style: TextStyle(fontWeight: FontWeight.bold,fontSize: 20), ), ] @@ -95,7 +86,8 @@ class settingsState extends State { return AlertDialog( // Retrieve the text the that user has entered by using the // TextEditingController. - content: Text("Url saved: " + myController.text), + title: Text("URL Saved: "), + content: Text(_textFromFile), ); }, diff --git a/flutter-android-ios-app/notion_ai_my_mind/pubspec.lock b/flutter-android-ios-app/notion_ai_my_mind/pubspec.lock index 026a5de..448dbb3 100644 --- a/flutter-android-ios-app/notion_ai_my_mind/pubspec.lock +++ b/flutter-android-ios-app/notion_ai_my_mind/pubspec.lock @@ -1,48 +1,55 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + args: + dependency: transitive + description: + name: args + url: "https://pub.dartlang.org" + source: hosted + version: "1.6.0" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.2" + version: "2.5.0-nullsafety.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0-nullsafety.1" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.1.0-nullsafety.3" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.3" + version: "1.2.0-nullsafety.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.1.0-nullsafety.1" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.13" + version: "1.15.0-nullsafety.3" cupertino_icons: dependency: "direct main" description: @@ -70,7 +77,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0-nullsafety.1" ffi: dependency: transitive description: @@ -90,6 +97,13 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_automation: + dependency: "direct main" + description: + name: flutter_automation + url: "https://pub.dartlang.org" + source: hosted + version: "1.4.0" flutter_local_notifications: dependency: "direct main" description: @@ -148,21 +162,21 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.8" + version: "0.12.10-nullsafety.1" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.8" + version: "1.3.0-nullsafety.3" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0-nullsafety.1" path_provider: dependency: "direct main" description: @@ -293,42 +307,42 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0-nullsafety.2" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.5" + version: "1.10.0-nullsafety.1" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0-nullsafety.1" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.1.0-nullsafety.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0-nullsafety.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.17" + version: "0.2.19-nullsafety.2" timezone: dependency: transitive description: @@ -342,7 +356,7 @@ packages: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.0-nullsafety.3" url_launcher: dependency: "direct main" description: @@ -391,7 +405,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.0-nullsafety.3" webview_flutter: dependency: "direct main" description: @@ -413,6 +427,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.1.0" + yaml: + dependency: transitive + description: + name: yaml + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.1" sdks: - dart: ">=2.9.0-14.0.dev <3.0.0" + dart: ">=2.10.0-110 <2.11.0" flutter: ">=1.12.13+hotfix.5 <2.0.0" diff --git a/flutter-android-ios-app/notion_ai_my_mind/pubspec.yaml b/flutter-android-ios-app/notion_ai_my_mind/pubspec.yaml index 918eec6..73e06ec 100644 --- a/flutter-android-ios-app/notion_ai_my_mind/pubspec.yaml +++ b/flutter-android-ios-app/notion_ai_my_mind/pubspec.yaml @@ -33,6 +33,7 @@ dependencies: device_info: ^0.4.2+4 path_provider: ^1.6.7 rxdart: ^0.24.0 + flutter_automation: ^1.4.0 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^0.1.3