Skip to content

Commit

Permalink
documentation fix for #380
Browse files Browse the repository at this point in the history
  • Loading branch information
sarika gautam authored and sarika gautam committed Mar 14, 2022
1 parent b5f50a9 commit 04f7487
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 23 deletions.
54 changes: 37 additions & 17 deletions at_events_flutter/README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,55 @@
<img width=250px src="https://atsign.dev/assets/img/@platform_logo_grey.svg?sanitize=true">

### Now for some internet optimism.

[![pub package](https://img.shields.io/pub/v/at_events_flutter)](https://pub.dev/packages/at_events_flutter) [![](https://img.shields.io/static/v1?label=Backend&message=@Platform&color=<COLOR>)](https://atsign.dev) [![](https://img.shields.io/static/v1?label=Publisher&message=The%20@%20Company&color=F05E3E)](https://atsign.com) [![gitHub license](https://img.shields.io/badge/license-BSD3-blue.svg)](./LICENSE)

# at_events_flutter
## Overview
The at_events_flutter package is for Flutter developers who would like to integrate event management feature in their apps.

## Introduction
This open source package is written in Dart, supports Flutter and follows the @‎platform's decentralized, edge computing model with the following features:
- Cryptographic control of data access through personal data stores
- No application backend needed
- End to end encryption where only the data owner has the keys
- Private and surveillance free connectivity
- Create and update event with location and participants

A flutter plugin project to manage events between atsigns.
We call giving people control of access to their data “flipping the internet” and you can learn more about how it works by reading this [overview](https://atsign.dev/docs/overview/).

## Get Started:

Initially to get a basic overview of the SDK, you must read the [atsign docs](https://atsign.dev/docs/overview/).
There are three options to get started using this package.

> To use this package you must be having a basic setup, Follow here to [get started](https://atsign.dev/docs/get-started/setup-your-env/).
### 1. Quick start - generate a skeleton app with at_app
This package includes a working sample application in the
[Example](https://github.com/atsign-foundation/at_widgets/tree/trunk/at_events_flutter/example) directory that you can use to create a personalized copy using ```at_app create``` in four commands.

```sh
$ flutter pub global activate at_app
$ at_app create --sample=<package ID> <app name>
$ cd <app name>
$ flutter run
```
Notes:
1. You only need to run ```flutter pub global activate``` once
2. Use ```at_app.bat``` for Windows

### Manually add the package to a project:
### 2. Clone it from GitHub
Feel free to fork a copy of the source from the [GitHub repo](https://github.com/atsign-foundation/at_widgets). The example code contained there is the same as the template that is used by at_app above.

Instructions on how to manually add this package to you project can be found on pub.dev [here](https://pub.dev/packages/at_events_flutter/install).
```sh
$ git clone https://github.com/atsign-foundation/at_widgets.git
```

### Clone it from github
### 3. Manually add the package to a project

Feel free to fork a copy of the source from the [GitHub Repo](https://github.com/atsign-foundation/at_widgets)
Instructions on how to manually add this package to you project can be found on pub.dev [here](https://pub.dev/packages/at_events_flutter/install).

## How it works

### Setup
### Initialising:
It is expected that the app will first authenticate an atsign using the Onboarding widget.

The event service needs to be initialised with a required GlobalKey<NavigatorState> parameter for
navigation purpose (make sure the key is passed to the parent [MaterialApp]), the rest being optional parameters.
The event service needs to be initialised with a required GlobalKey<NavigatorState> parameter for navigation purpose (make sure the key is passed to the parent [MaterialApp]), the rest being optional parameters.

```
initialiseEventService(
Expand Down Expand Up @@ -71,8 +91,7 @@ To create a new event, using the default screen:
),
```

To use event creation/edit functions, use the [EventService()] singleton,
make sure to call [EventService().init()] before using these functions:
To use event creation/edit functions, use the [EventService()] singleton, make sure to call [EventService().init()] before using these functions:
- createEvent() - Can create and edit based on [isEventUpdate] passed to [init()]
- editEvent() - Will update the already created event
- sendEventNotification() - Will create a new event
Expand Down Expand Up @@ -105,7 +124,8 @@ Different datatypes used in the package:

We have a good example with explanation in the [at_events_flutter](https://pub.dev/packages/at_events_flutter/example) package.


## Open source usage and contributions
This is open source code, so feel free to use it as is, suggest changes or enhancements or create your own version. See [CONTRIBUTING.md](https://github.com/atsign-foundation/at_widgets/blob/trunk/CONTRIBUTING.md) for detailed guidance on how to setup tools, tests and make a pull request.


This is freely licensed open source code, so feel free to use it as is, suggest changes or enhancements or create your
own version. See [CONTRIBUTING.md](https://github.com/atsign-foundation/at_widgets/blob/trunk/CONTRIBUTING.md) for detailed guidance on how to setup tools, tests and make a pull request.
24 changes: 18 additions & 6 deletions at_events_flutter/example/EXAMPLE.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
<img width=250px src="https://atsign.dev/assets/img/@platform_logo_grey.svg?sanitize=true">

## [at_events_flutter] example
## at_events_flutter example
The [at_events_flutter] package is designed to make it easy to manage events between atsigns.

### Give it a try
This package includes a working sample application in the [example](https://github.com/atsign-foundation/at_widgets/tree/trunk/at_events_flutter/example) directory that demonstrates the key features of the package. To create a personalized copy, use ```at_app create``` as shown below or check it out on GitHub.

```sh
$ flutter pub global activate at_app
$ at_app create --sample=<package ID> <app name>
$ cd <app name>
$ flutter run
```
Notes:
1. You only need to run ```flutter pub global activate``` once
2. Use ```at_app.bat``` for Windows

## How it works

Like most applications built for the @‎platform, we start with the [at_onboarding_flutter](https://pub.dev/packages/at_onboarding_flutter) widget which handles secure management of secret keys for an atsign as cryptographically secure replacement for usernames and passwords.
Expand All @@ -20,9 +33,9 @@ As the [at_events_flutter] package has to be initialised, so we initialise it in
streamAlternative: updateEvents
);
```
NOTE: Make sure to pass in the [MAP_KEY] and the [API_KEY] in the `.env` file.

NOTE: The [at_events_flutter] depends on [at_location_flutter] for location sharing, so we use the default value of [initLocation] (true) in [initialiseEventService()].
NOTE:
1. Make sure to pass in the [MAP_KEY] and the [API_KEY] in the `.env` file.
2. The [at_events_flutter] depends on [at_location_flutter] for location sharing, so we use the default value of [initLocation] (true) in [initialiseEventService()].

We also pass a function [updateEvents] to [initialiseEventService()] in the [streamAlternative] parameter which will give us a list of updated events from the [at_events_flutter] package.

Expand All @@ -32,5 +45,4 @@ The [second_screen.dart] consists of the following functions:

## Open source usage and contributions

This is freely licensed open source code, so feel free to use it as is, suggest changes or enhancements or create your
own version. See [CONTRIBUTING.md](https://github.com/atsign-foundation/at_widgets/blob/trunk/CONTRIBUTING.md) for detailed guidance on how to setup tools, tests and make a pull request.
Like everything else we do, this package and even the sample application are open source software which means we love it when you gift us with your feedback, contributions and even any bugs that you help us to discover. See [CONTRIBUTING.md](https://github.com/atsign-foundation/at_widgets/blob/trunk/CONTRIBUTING.md) for detailed guidance on how to setup tools, tests and make a pull request.
48 changes: 48 additions & 0 deletions at_events_flutter/example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<img width=250px src="https://atsign.dev/assets/img/@platform_logo_grey.svg?sanitize=true">

## at_events_flutter example
The [at_events_flutter] package is designed to make it easy to manage events between atsigns.

### Give it a try
This package includes a working sample application in the [example](https://github.com/atsign-foundation/at_widgets/tree/trunk/at_events_flutter/example) directory that demonstrates the key features of the package. To create a personalized copy, use ```at_app create``` as shown below or check it out on GitHub.

```sh
$ flutter pub global activate at_app
$ at_app create --sample=<package ID> <app name>
$ cd <app name>
$ flutter run
```
Notes:
1. You only need to run ```flutter pub global activate``` once
2. Use ```at_app.bat``` for Windows

## How it works

Like most applications built for the @‎platform, we start with the [at_onboarding_flutter](https://pub.dev/packages/at_onboarding_flutter) widget which handles secure management of secret keys for an atsign as cryptographically secure replacement for usernames and passwords.

We use the [Onboarding()] widget in our [main.dart] and navigate to our [second_screen.dart] after successfully onboarding.

If you want to remove any already paired atsign, use the `Clear paired atsigns` button, it will remove all the paired atsigns for this example package.

As the [at_events_flutter] package has to be initialised, so we initialise it in the [init()] of `second_screen.dart` by calling
```dart
initialiseEventService(NavService.navKey,
mapKey: dotenv.get('MAP_KEY'),
apiKey: dotenv.get('API_KEY'),
rootDomain: 'root.atsign.org',
streamAlternative: updateEvents
);
```
NOTE:
1. Make sure to pass in the [MAP_KEY] and the [API_KEY] in the `.env` file.
2. The [at_events_flutter] depends on [at_location_flutter] for location sharing, so we use the default value of [initLocation] (true) in [initialiseEventService()].

We also pass a function [updateEvents] to [initialiseEventService()] in the [streamAlternative] parameter which will give us a list of updated events from the [at_events_flutter] package.

The [second_screen.dart] consists of the following functions:
- Create event - Will build the default create event bottomsheet. To use this functionality call [CreateEvent()].
- Move to the map screen for an event - Call [HomeEventService().onEventModelTap()] and pass in the event parameter.

## Open source usage and contributions

Like everything else we do, this package and even the sample application are open source software which means we love it when you gift us with your feedback, contributions and even any bugs that you help us to discover. See [CONTRIBUTING.md](https://github.com/atsign-foundation/at_widgets/blob/trunk/CONTRIBUTING.md) for detailed guidance on how to setup tools, tests and make a pull request.

0 comments on commit 04f7487

Please sign in to comment.