hints 0.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 57

hints #

A simple widget for showing dismissible help texts to the user. If the widget is dismissed, it will remember by saving the state in persistent storage and will never be shown again.

Usage #

Import the package #

To use this package, add hints as a dependency in your pubspec.yaml

Use the package #

import 'package:hints/hints.dart';

The main widget to use is HintCard.

The widget need a unique Key to keep track of if the widget is hidden or not.

It also needs a hint text and can be provided an icon.

Note: The widget will assert if no key is provided. Don't provide a generated key as it will not match next run.

Getting started #

Please look at the example code for getting started.

Screenshot

[0.0.1] - 03/09/2019

  • Initial release.

[0.0.2] - 04/09/2019

Features:

  • Added a flag to force show the widget. This can be used for testing purposes.

example/lib/main.dart

// Copyright 2019 Mattias Månsson. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

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

void main() {
  runApp(new MaterialApp(
    home: new MyHomePage(),
  ));
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  var isEnabled = true;

  @override
  void initState() {
    super.initState();

    //HintCard.resetHidden();
  }

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(),
      body: Center(
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.center,
          children: <Widget>[
            HintCard(
              key: Key('MyUniqueHintKey'),
              text:
              'This is a little help text for the first time user. Just press the little X to dismiss it forever...',
            ),
            HintCard(
              key: Key('MyUniqueHintKey2'),
              text:
              'This is a 2nd little help text for the first time user. Just press the little X to dismiss it forever...',
            ),
            HintCard(
              key: Key('MyUniqueHintKey3'),
              text:
              'This is a 3rd little help text for the first time user. Just press the little X to dismiss it forever...',
            ),
            FlatButton(
              child: Text('Reset'),
              onPressed: () async {
                await HintCard.resetHidden();
                setState(() {});
              },
            )
          ],
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  hints: ^0.0.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:hints/hints.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
18
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
57
Learn more about scoring.

We analyzed this package on Oct 22, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/hints.dart.

Run flutter format to format lib/hints.dart.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
shared_preferences ^0.5.3+4 0.5.4
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test