Skip to content

Commit

Permalink
Running on mobile (#34)
Browse files Browse the repository at this point in the history
* Running the project on mobile

* Update .gitignore

* Updating readme

* removing not needed files
  • Loading branch information
tomaszpolanski authored Jul 29, 2019
1 parent 6237c29 commit d6ca3a7
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ lib/generated/i18n.dart
res/

android/local.properties
/android/.gradle
ios/Flutter/Generated.xcconfig
44 changes: 42 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,51 @@ List of animations and transitions that you can used in Flutter.

Available as a [webpage](https://flutter-animations-cheat-sheet.codemagic.app/#/).

## Building on Desktop
# Building
By default the project is setup to be built for web.
To toggle build configuration run `toggle.sh` on Linux/Mac and `toggle.bat` on Windows.

* Last tested version of Flutter that works with this repo is `v1.7.8+hotfix.3`:
* **Important**: Use `version` otherwise desktop won't be picked up: `flutter version v1.7.8+hotfix.3`

## Building and running Desktop application
## Building for Mobile
Run `toggle` script and proceed the same way as with a normal Flutter.

## Building for Web
1. To install the
[`webdev` package](https://pub.dartlang.org/packages/webdev),
which provides the build tools for Flutter for web, run the following:

```console
$ flutter pub global activate webdev
```

Ensure that the `$HOME/.pub-cache/bin` directory
[is in your path](https://www.dartlang.org/tools/pub/cmd/pub-global#running-a-script-from-your-path),
and then you may use the `webdev` command directly from your terminal.

> Note: if you have problems configuring `webdev` to run directly, try:<br>
`flutter pub global run webdev [command]`.
2. Update packages
```console
$ flutter pub upgrade
```
3. Build and serve the example locally.
```console
$ webdev serve
[INFO] Generating build script completed, took 331ms
...
[INFO] Building new asset graph completed, took 1.4s
...
[INFO] Running build completed, took 27.9s
...
[INFO] Succeeded after 28.1s with 618 outputs (3233 actions)
Serving `web` on http://localhost:8080
```
Open <http://localhost:8080> in Chrome

## Building for Desktop
* First enable desktop imports (defaults are web) buy running `./toggle.sh` script
### Linux
- Add the following to `.bash_profile` but replace `$HOME/flutter/` with path to your Flutter folder
Expand Down
9 changes: 0 additions & 9 deletions ios/Flutter/Generated.xcconfig

This file was deleted.

2 changes: 2 additions & 0 deletions lib/tools/toggle.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ Future<void> main() async {
await File(materialDesktop).rename(material);
await File(test).rename(testWeb);
await File(testDesktop).rename(test);
print('Changed configuration to Desktop/Mobile');
} else {
await File(yaml).rename(yamlDesktop);
await File(yamlWeb).rename(yaml);
await File(material).rename(materialDesktop);
await File(materialWeb).rename(material);
await File(test).rename(testDesktop);
await File(testWeb).rename(test);
print('Changed configuration to Web');
}
}

Expand Down
30 changes: 30 additions & 0 deletions test/widget_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// 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:animation_cheat_page/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);
});
}
2 changes: 2 additions & 0 deletions toggle.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dart ./lib/tools/toggle.dart
flutter packages get

0 comments on commit d6ca3a7

Please sign in to comment.