Skip to content

Release/1.0.26 #343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Mar 28, 2020
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
9f3bf01
Release/1.0.26 - Update docs
phillwiggins Jan 11, 2020
8a5dddc
Updated Live Queries related documentation (#301)
mregandla Jan 21, 2020
6c95686
Added an example of how to update existing object values (#309)
rommyarb Feb 18, 2020
699778d
Specifying return type of get<T> as T instead of dynamic (#310)
PawlikMichal25 Feb 19, 2020
8b3fc18
Live query connection stream (#314)
fischerscode Mar 2, 2020
0f4a650
Livequery reconnecting controller (#316)
fischerscode Mar 3, 2020
a85487b
Parsequery OR (#317)
fischerscode Mar 4, 2020
82937c6
Fix for Sembast-API change (#322)
fischerscode Mar 6, 2020
6a0ae4c
added QueryBuilder.copy(QueryBuilder<T> query) (#320)
fischerscode Mar 6, 2020
085ffb2
ParseLiveList (#324)
fischerscode Mar 10, 2020
16f9e96
added ParseACL to parseEncode (#326)
fischerscode Mar 10, 2020
3fdbe97
ParseLiveList Performance improvement (#327)
fischerscode Mar 10, 2020
da7b63f
ParseLiveListElementSnapshot added (#329)
fischerscode Mar 10, 2020
511bee8
Clear unsaved changes (#331)
fischerscode Mar 12, 2020
c73c83e
LiveQueryController: connect at init (#332)
fischerscode Mar 12, 2020
f814dc9
LiveList: fixed defaultBuilder (#333)
fischerscode Mar 12, 2020
f8af2b6
Added generics to Query/LiveQuery (#336)
fischerscode Mar 13, 2020
46bd2d1
LiveQuery: fixes list is null (#334)
fischerscode Mar 28, 2020
6de1db9
Fix: #341 (#342)
fischerscode Mar 28, 2020
bb4eef6
Updating LiveQuery for web (#340)
fischerscode Mar 28, 2020
3163da6
Release/1.0.26 - Code formatting, remove lint issues
phillwiggins Mar 28, 2020
0e4bc3f
Release 1.0.26 - Release candidate
phillwiggins Mar 28, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -28,6 +28,8 @@ build/
example/ios/Frameworks/
example/lib/ui/

example_livelist/lib/application_constants.dart

.flutter-plugins-dependencies

.vscode/
69 changes: 68 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ Want to get involved? Join our Slack channel and help out! (http://flutter-parse
To install, either add to your pubspec.yaml
```yml
dependencies:
parse_server_sdk: ^1.0.25
parse_server_sdk: ^1.0.26
```
or clone this repository and add to your project. As this is an early development with multiple contributors, it is probably best to download/clone and keep updating as an when a new feature is added.

@@ -57,6 +57,13 @@ var dietPlan = ParseObject('DietPlan')
..set('Fat', 65);
await dietPlan.save();
```
Or update existing object by its objectId by calling:
```dart
var dietPlan = ParseObject('DietPlan')
..objectId = 'R5EonpUDWy'
..set('Fat', 70);
await dietPlan.save();
```
Verify that the object has been successfully saved using
```dart
var response = await dietPlan.save();
@@ -423,6 +430,66 @@ LiveQuery server.
liveQuery.client.unSubscribe(subscription);
```

## ParseLiveList
ParseLiveList makes implementing a dynamic List as simple as possible.


It ships with the ParseLiveList class itself, this class manages all elements of the list, sorts them,
keeps itself up to date and Notifies you on changes.

ParseLiveListWidget is a widget that handles all the communication with the ParseLiveList for you.
Using ParseLiveListWidget you can create a dynamic List by just providing a QueryBuilder.

```dart
ParseLiveListWidget<ParseObject>(
query: query,
);
```
To customize the List Elements, you can provide a childBuilder.
```dart
ParseLiveListWidget<ParseObject>(
query: query,
reverse: false,
childBuilder:
(BuildContext context, bool failed, ParseObject loadedData) {
if (failed) {
return const Text('something went wrong!');
} else if (loadedData != null) {
return ListTile(
title: Text(
loadedData.get("text"),
),
);
} else {
return const ListTile(
leading: CircularProgressIndicator(),
);
}
},
);
```
Similar to the standard ListView, you can provide arguments like reverse or shrinkWrap.
By providing the listLoadingElement, you can show the user something while the list is loading.
```dart
ParseLiveListWidget<ParseObject>(
query: query,
childBuilder: childBuilder,
listLoadingElement: Center(
child: CircularProgressIndicator(),
),
);
```
By providing the duration argument, you can change the animation speed.
```dart
ParseLiveListWidget<ParseObject>(
query: query,
childBuilder: childBuilder,
duration: Duration(seconds: 1),
);
```

Note: To use this features you have to enable [Live Queries](#live-queries) first.

## Users
You can create and control users just as normal using this SDK.

4 changes: 2 additions & 2 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -68,7 +68,7 @@ class _MyAppState extends State<MyApp> {
Future<void> initData() async {
// Initialize repository
await initRepository();
final CoreStore coreStore = await initCoreStore();
await initCoreStore();

// Initialize parse
await Parse().initialize(keyParseApplicationId, keyParseServerUrl,
@@ -233,7 +233,7 @@ class _MyAppState extends State<MyApp> {
user = response.result;
}*/

ParseUser user1 = await ParseUser.currentUser();
final ParseUser user1 = await ParseUser.currentUser();
user1.authData;

/// Login
10 changes: 5 additions & 5 deletions example/lib/pages/home_page.dart
Original file line number Diff line number Diff line change
@@ -74,8 +74,8 @@ class _HomePageState extends State<HomePage> {
if (snapshot.data.success) {
if (snapshot.data.results == null ||
snapshot.data.results.isEmpty) {
return Center(
child: const Text('No Data'),
return const Center(
child: Text('No Data'),
);
}
}
@@ -97,7 +97,7 @@ class _HomePageState extends State<HomePage> {
child: ListTile(
title: Text(
name,
style: TextStyle(fontSize: 20.0),
style: const TextStyle(fontSize: 20.0),
),
subtitle: Text(description),
trailing: IconButton(
@@ -118,8 +118,8 @@ class _HomePageState extends State<HomePage> {
);
});
} else {
return Center(
child: const Text('No Data'),
return const Center(
child: Text('No Data'),
);
}
});
10 changes: 5 additions & 5 deletions example/lib/pages/login_page.dart
Original file line number Diff line number Diff line change
@@ -114,7 +114,7 @@ class _LoginPageState extends State<LoginPage> {

Widget _showCircularProgress() {
if (_isLoading) {
return Center(child: const CircularProgressIndicator());
return const Center(child: CircularProgressIndicator());
}
return Container(
height: 0.0,
@@ -179,9 +179,9 @@ class _LoginPageState extends State<LoginPage> {
maxLines: 1,
keyboardType: TextInputType.emailAddress,
autofocus: false,
decoration: InputDecoration(
decoration: const InputDecoration(
hintText: 'Email',
icon: const Icon(
icon: Icon(
Icons.mail,
color: Colors.grey,
)),
@@ -199,9 +199,9 @@ class _LoginPageState extends State<LoginPage> {
maxLines: 1,
obscureText: true,
autofocus: false,
decoration: InputDecoration(
decoration: const InputDecoration(
hintText: 'Password',
icon: const Icon(
icon: Icon(
Icons.lock,
color: Colors.grey,
)),
Original file line number Diff line number Diff line change
@@ -100,9 +100,10 @@ void main() {
// When
final ApiResponse baseResponse = await repository.add(dummy);
final ApiResponse responseWithResult = await repository
.getNewerThan(DateTime.now().subtract(Duration(days: 1)));
.getNewerThan(DateTime.now().subtract(const Duration(days: 1)));
final ApiResponse responseWithoutResult =
await repository.getNewerThan(DateTime.now().add(Duration(days: 1)));
await repository.getNewerThan(
DateTime.now().add(const Duration(days: 1)));

// CLEAR FROM DB
await deleteFromApi(baseResponse.results);
Original file line number Diff line number Diff line change
@@ -131,7 +131,7 @@ void main() {

// When
DateTime dateTime = DateTime.now();
dateTime = dateTime.subtract(Duration(hours: 1));
dateTime = dateTime.subtract(const Duration(hours: 1));
final ApiResponse updateResponse = await repository.getNewerThan(dateTime);
final List<DietPlan> actual = updateResponse.results;

37 changes: 37 additions & 0 deletions example_livelist/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/

# Web related
lib/generated_plugin_registrant.dart

# Exceptions to above rules.
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
10 changes: 10 additions & 0 deletions example_livelist/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: 0b8abb4724aa590dd0f429683339b1e045a1594d
channel: stable

project_type: app
9 changes: 9 additions & 0 deletions example_livelist/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# ParesLiveList example
Change application_constants.dart and give it a try.

You need a class "Test" with the fields <String> text, <Boolean> show and <Number> order in your database.
You have to add some data by yourself. (The app is TO simple)
(The class should be Read/Write for public)

It's recommended to use the Parse Dashboard to manipulate the data.
This way, you will be able to hide objects and edit items, while your device is offline.
7 changes: 7 additions & 0 deletions example_livelist/android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
67 changes: 67 additions & 0 deletions example_livelist/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 28

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

lintOptions {
disable 'InvalidPackage'
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.flutterpluginexample_livelist"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

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
}
}
}

flutter {
source '../..'
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
7 changes: 7 additions & 0 deletions example_livelist/android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.flutterpluginexample_livelist">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
30 changes: 30 additions & 0 deletions example_livelist/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.flutterpluginexample_livelist">
<!-- 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
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="flutterpluginexample_livelist"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.example.example_livelist

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.example.flutterpluginexample_livelist

import androidx.annotation.NonNull;
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.GeneratedPluginRegistrant

class MainActivity: FlutterActivity() {
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine);
}
}
Loading