healthrian_ble_support_for_wearcardiot 1.0.5 copy "healthrian_ble_support_for_wearcardiot: ^1.0.5" to clipboard
healthrian_ble_support_for_wearcardiot: ^1.0.5 copied to clipboard

unlisted

Healthrian BLE support library for WearCardioT

example/README.md

Example for Healthrian BLE support library for WearCardioT #

coverage style: very good analysis License: MIT

Generated by the Very Good CLI πŸ€–

Example for Healthrian BLE support library for WearCardioT

Example code #

lib/ble/view/ble_page.dart

import 'package:flutter/material.dart';
import 'package:healthrian_visualization_support/'
    'healthrian_visualization_support.dart';

class BLEPage extends StatelessWidget {
  const BLEPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: const [
          EcgWearT(),
          OxiWearT(),
        ],
      ),
      floatingActionButton: const ControlPanel(),
    );
  }
}

Change the minSdkVersion for Android #

flutter_blue_plus is compatible only from version 19 of Android SDK so you should change this in android/app/build.gradle:

Android {
  defaultConfig {
     minSdkVersion: 19

Add permissions for Bluetooth #

We need to add the permission to use Bluetooth and access location:

Android

In the android/app/src/main/AndroidManifest.xml let’s add:

	 <uses-permission android:name="android.permission.BLUETOOTH" />  
	 <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />  
	 <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>  
 <application

IOS

In the ios/Runner/Info.plist let’s add:

	<dict>  
	    <key>NSBluetoothAlwaysUsageDescription</key>  
	    <string>Need BLE permission</string>  
	    <key>NSBluetoothPeripheralUsageDescription</key>  
	    <string>Need BLE permission</string>  
	    <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>  
	    <string>Need Location permission</string>  
	    <key>NSLocationAlwaysUsageDescription</key>  
	    <string>Need Location permission</string>  
	    <key>NSLocationWhenInUseUsageDescription</key>  
	    <string>Need Location permission</string>

edit pubspec.yaml file #

Add dependencies of both BLE support and visualization support libraries. pubspec.yaml

dependencies:
  healthrian_ble_support_for_wearcardiot: ^1.0.4

  healthrian_visualization_support: ^1.0.8+1

And then run a pub get in the terminal.

flutter pub get

from scratch via very good cli #

very_good.bat create example --desc "Example for Healthrian BLE support library for WearCardioT" --org "com.healthrian.library.ble.example"

Getting Started πŸš€ #

This project contains 3 flavors:

  • development
  • staging
  • production

To run the desired flavor either use the launch configuration in VSCode/Android Studio or use the following commands:

# Development
$ flutter run --flavor development --target lib/main_development.dart

# Staging
$ flutter run --flavor staging --target lib/main_staging.dart

# Production
$ flutter run --flavor production --target lib/main_production.dart

*Example works on iOS, Android, Web, and Windows.


Running Tests πŸ§ͺ #

To run all unit and widget tests use the following command:

$ flutter test --coverage --test-randomize-ordering-seed random

To view the generated coverage report you can use lcov.

# Generate Coverage Report
$ genhtml coverage/lcov.info -o coverage/

# Open Coverage Report
$ open coverage/index.html

Working with Translations 🌐 #

This project relies on flutter_localizations and follows the official internationalization guide for Flutter.

Adding Strings #

  1. To add a new localizable string, open the app_en.arb file at lib/l10n/arb/app_en.arb.
{
    "@@locale": "en",
    "counterAppBarTitle": "Counter",
    "@counterAppBarTitle": {
        "description": "Text shown in the AppBar of the Counter Page"
    }
}
  1. Then add a new key/value and description
{
    "@@locale": "en",
    "counterAppBarTitle": "Counter",
    "@counterAppBarTitle": {
        "description": "Text shown in the AppBar of the Counter Page"
    },
    "helloWorld": "Hello World",
    "@helloWorld": {
        "description": "Hello World Text"
    }
}
  1. Use the new string
import 'package:example/l10n/l10n.dart';

@override
Widget build(BuildContext context) {
  final l10n = context.l10n;
  return Text(l10n.helloWorld);
}

Adding Supported Locales #

Update the CFBundleLocalizations array in the Info.plist at ios/Runner/Info.plist to include the new locale.

    ...

    <key>CFBundleLocalizations</key>
	<array>
		<string>en</string>
		<string>es</string>
	</array>

    ...

Adding Translations #

  1. For each supported locale, add a new ARB file in lib/l10n/arb.
β”œβ”€β”€ l10n
β”‚   β”œβ”€β”€ arb
β”‚   β”‚   β”œβ”€β”€ app_en.arb
β”‚   β”‚   └── app_es.arb
  1. Add the translated strings to each .arb file:

app_en.arb

{
    "@@locale": "en",
    "counterAppBarTitle": "Counter",
    "@counterAppBarTitle": {
        "description": "Text shown in the AppBar of the Counter Page"
    }
}

app_es.arb

{
    "@@locale": "es",
    "counterAppBarTitle": "Contador",
    "@counterAppBarTitle": {
        "description": "Texto mostrado en la AppBar de la pΓ‘gina del contador"
    }
}
1
likes
0
pub points
5%
popularity

Publisher

unverified uploader

Healthrian BLE support library for WearCardioT

Homepage

License

unknown (LICENSE)

Dependencies

collection, fl_chart, flutter, flutter_blue_plus, flutter_mobx, healthrian_common_support, lzma, mobx

More

Packages that depend on healthrian_ble_support_for_wearcardiot