• Stars
    star
    141
  • Rank 259,971 (Top 6 %)
  • Language
    Dart
  • Created almost 6 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Flutter App (Embedded Watch Kit app with iOS version)

watchtips

Update Jul 2022

As there has been no development on the codebase, and hence no app release for some time(this was really a POC). The app in the iOS app store has been withdrawn from sale by Apple.

Update Version 2.2

The Watch tips project has been updated again, The interface has been tidied up and a seperate value for the tip cost has been added and displayed ( a requested update). I have also added a custom 'keypad' rather than using the standard one available for the platform, hopefully the app now looks a bit better than it did - UX/UI design is not my strong point.

But the biggest update is that there is now also an Android version (without Watch support). Doing this has helped a lot as I can use the Flutter Android app for development purposes so that I now have Hot Reload back (development is good again ....)

For iOS, I still need to run/build (and fail) with the Flutter tools for iOS (this is required to generate the correct build scripts) and finish with XCode, but general dev is know easier.

Overview

This was an originally experiment to see if can use Flutter to build an iOS app with an accompanying watchOS app. My first attempts using the beta product were not successful so the idea was parked. Having now re-visited this I can now get a compiled blank watch app up and running with a Flutter app, so I will, in stages, try and re-create the WatchTips app using Flutter.

If you interested in the original Titanium version is here

Watch App

App Store Link

Ths app is a really simple app and originally just created as a proof point.

But for anyone interested here are the release links:

Plan

  • 1.0 Create a vanilla Flutter app (this initial commit)
  • 1.1 Add a blank watch project and get it working
  • 1.2 Modify the watch app functionally into WatchTips
  • 1.3 Update the Flutter app to WatchTips
  • 1.4 See if I can bridge between the 2 app (as the Titanium version does)
  • 2.0 Tidy up both the Flutter code and the iOS project and use it to submit the app into the App Store
  • 2.x+ - updates and improvements

Flutter Package Project

From the results of this test project, I have started developing a Flutter Package to allow communication between a Flutter iOS app and a watch app. This should allow easier integration with some standard functionality, though it is still a pain ATM as after you add a Watch Kit target to the iOS project as Flutter run/build no longer works. This means all package testing and development then needs to be done via XCode.

I have got messaging working from an iOS app to the watch via the plugin, this can be seen working in avideo here.

Generating a Distro build

The only way, so far, I have found of creating a distro build is following this seqence.

Set the Bundle ID

BEFORE adding the Watch Kit app target set the final bundle ID, as the Watch app and associated extension needs to use the same prefix. If not you may need to update all references BEFORE creating the final Archive.

Change ALL the Version and Build values

This MUST be done for each target (in this case 3), change them to $(FLUTTER_BUILD_NAME) and $(FLUTTER_BUILD_NUMBER) respectively, otherwise although the test runs work, the Archive will not unless the version numbers match.

Run the Flutter build first

This will fail, but it generates the correct shell scripts to enable iOS to carry out the build (flutter build ios --release).

Create Archive in XCode

  • 1 Select Generic Device + watchOS Device as the destination
  • 2 Run Product -> Archive
  • 3 If build successful , run the Validate App
  • 4 If validate successful - upload to App Store!!!

Versions

2.1

  • updated Watch and Phone UI
  • currency now defaults to the phone/ipad locale
  • package made universal, so it runs on iPad (no watch supoort)

2.0

  • first app store release

1.4 - Rough and Ready but Working!

I have now managed to add the required code into the iOS project to allow it to communicate with Flutter and send data updates from the watch so they are reflected in the app. Basically if you do a calculation for a Tip on the watch then the data is transferred to the associated device.

You need to forgive the (bad?) Objective C coding as it is not really my thing - who in their right mind thought of it in the first place anyway :-) . A lot of this was just brute force trial and error as well as a lot of searching and testing.

Apart from that the difficult issue for me was that although MethodChannel is quite well documented, EventChannel is not, the only examples I found were to do with Plugin extensions, but again probably due to my dislike (due to not understanding it very well) of Objective C.

I will try to create a generic plug-in later, but that will be done in Swift.

1.3

So after a bit of a hair pulling out session I have managed to get this working. I now have a iWatch app as well as a Flutter iOS app to build and run. I have tested this by building and distribuing to a physical phone via HockeyApp. Now the bad news......

I cannot use Flutter to either build the Flutter project or do the iOS release build, so I actually built the Flutter app in a seperate project then added the lib dir back into this one. This is a major pain as to do an testing, on device or simulator I need to use XCode to do all the build (i.e. no hot-reloading), but it does work.

To create the AD-HOC distro of the app I again used XCode, set the target to Generic Device and Archived the project. The resulting AD-OC signed app works well.

But I think the last stage will be a major hurdle as I WILL need to do all building using XCode.........

1.2

Updated Watch app and added functioning WatchTips. Watch app can now be used to calculate Bill split and tips.

1.1

After using XCode to define a simulator with an attached Watch Emulator the standard Vanilla app (from 1.0) was updated as follows

  • Set a bundle id on the iOS Runner app (u.spiralarm.watchtips)
  • Add a new Target in XCode (File->New->Target), a WatchKit app was selected
  • Untick Include Notification Scene and Include Complication
  • Name the product WatchTips
  • Generate 2 sets of assets (I use an app called Asset Catalog Creator), one for the Runner app and one for the Watch App so that both have a full set of icons.
  • Open the interface.storyboard for rhe WatchTips app and add a button to the screen

After this I can no longer user the IDE (VSC) to start the app up in debug mode as I get the following error ( perhaps some sort of cusom build configuration is required):

=== BUILD TARGET WatchTips Extension OF PROJECT Runner WITH CONFIGURATION Debug ===
target specifies product type 'com.apple.product-type.watchkit2-extension', but there's no such product type for the 'iphonesimulator' platform
Could not build the application for the simulator.
Error launching application on iPhone 7 with Watch 42mm.

However, if I use XCode I can use XCode to compile the app and run the watch app on the emulator.

Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

More Repositories

1

flutter-devicelocale

A Flutter package to read and return the set device locales
Dart
49
star
2

oscilloscope

A Flutter package that can display an Oscilloscope type graphical display
Dart
21
star
3

tvDemo

A NodeJS version of the AppleTV demo project
JavaScript
17
star
4

star-demo-es6

A Test Titanium App using ES6 and Promises
JavaScript
11
star
5

parse-connect

Parse client package for Flutter
Dart
9
star
6

sliver-image

A demo Flutter app showing a collapsing image in a scroll view
Dart
9
star
7

stack-overlay

A Flutter package providing a dismissible overlay
Dart
8
star
8

vertical-drag

Flutter app demo of a vertical drag container in a stack
Dart
7
star
9

d3-adventures-one

A simple Titanium example to create a graph using the D3.js library
JavaScript
7
star
10

peppa-test-harness

JavaScript
7
star
11

flutter-today-swift

Basic Flutter App with an embedded iOS Today Extension
Dart
6
star
12

TiAlloy-TDD

Titanium Alloy Jasmin Unit Test Widget
JavaScript
6
star
13

flutter-displaymetrics

Flutter code to query Android about the display Metrics of a device
Dart
6
star
14

form-factor

A flutter demo to detect the form factor of a device (phone or tablet)
Dart
5
star
15

polylingual-package

A Flutter package for creating multi language apps
Dart
4
star
16

sa.duckandcover

Titanium Studio JSDuck plug-in extension
JavaScript
4
star
17

ldbs-json

A nodejs module for accessing both OpenLDBWS and OpenLDBSVWS SOAP services that returns the results as JSON
JavaScript
4
star
18

flutter-pdf-doc

Test Flutter app for generating PDF documents
Dart
4
star
19

basicwatch

Demo iOS Flutter app with Embedded watchOS app
Dart
4
star
20

magnium

An ES6 based framework and CLI for creating Titanum mobile apps
JavaScript
3
star
21

waqiapi

A Flutter plugin to access the World Air Quality Index API
Dart
3
star
22

flutter-pdfreporter

Flutter PDF Document Generator
Dart
3
star
23

titanium-sac

A Titanium Plug-in for Sublime Text 3
Python
3
star
24

sa_flutter_flavor

Yet another Flavor based Flutter package
Dart
3
star
25

flutter-polylingual

A demo Flutter app using a custom class for string localisation
Dart
3
star
26

flutter-swapi

A demo Flutter project using SWAPI - The Star Wars API
Dart
2
star
27

ldbws-json

A NodeJS package to call the National Rail Enquiries OpenLDBWS SOAP service and return the data as a JSON object
JavaScript
2
star
28

ti-atom

Atom.io package for Titanium
JavaScript
1
star
29

Peppa-Sync-Books

Demo Ti App using a custom sync adapter to connect to a Drupal module
JavaScript
1
star
30

flutter-navigatortest

A test flutter project to investigator navigator and state behaviour
Dart
1
star
31

flutter-blank

Simple barebones blank flutter app
Dart
1
star
32

peppa

Drupal 7 module exposing a REST API and providing JSON object storage
PHP
1
star
33

riverpod-adventures

A collection of sample Flutter code based on Riverpod
Dart
1
star
34

jenkins-magnium

Testing Jenkins and Magnium
JavaScript
1
star
35

dart-pathrouter

a shelf middleware plugin
Dart
1
star