ruby_text 1.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 66

RubyText #

A ruby text widget with flutter.

Install #

dependencies:
    ruby_text: ^1.0.2

Example #

  RubyText(
    [
      RubyTextData(
        '検査',
        ruby: 'けんさ',
      ),
    ],
  );

Other #

  RubyText(
    this.data, {
    this.style,
    this.rubyStyle,
    this.onTapDown,
    this.onTapUp,
    this.onTap,
    this.onTapCancel,
    this.textAlign,
    this.textDirection,
    this.softWrap,
    this.overflow,
    this.maxLines,
  });

  RubyTextData(
    this.text, {
    this.ruby,
    this.style,
    this.rubyStyle,
    this.onTapDown,
    this.onTapUp,
    this.onTap,
    this.onTapCancel,
  });

// if you want to can use buildRubySpan 

WidgetSpan buildRubySpan(
  String text, {
  String ruby,
  BuildContext context,
  TextStyle style,
  TextStyle rubyStyle,
  GestureTapDownCallback onTapDown,
  GestureTapUpCallback onTapUp,
  GestureTapCallback onTap,
  GestureTapCancelCallback onTapCancel,
})

[1.0.1] - update LICENSE. #

[1.0.0] - init project. #

example/lib/main.dart

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

void main() {
  runApp(
    MyApp(),
  );
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: SafeArea(
          child: Padding(
            padding: const EdgeInsets.all(64),
            child: Center(
              child: Column(
                mainAxisSize: MainAxisSize.min,
                children: [
                  Padding(
                    padding: const EdgeInsets.all(16.0),
                    child: RubyText(
                      [
                        RubyTextData(
                          'でいごの',
                        ),
                        RubyTextData(
                          '花',
                          ruby: 'はな',
                        ),
                        RubyTextData(
                          'が',
                        ),
                        RubyTextData(
                          '咲',
                          ruby: 'さ',
                        ),
                        RubyTextData(
                          'き',
                        ),
                        RubyTextData(
                          '、',
                        ),
                        RubyTextData(
                          '風',
                          ruby: 'かぜ',
                        ),
                        RubyTextData(
                          'を',
                        ),
                        RubyTextData(
                          '呼',
                          ruby: 'よ',
                        ),
                        RubyTextData(
                          'び',
                        ),
                        RubyTextData(
                          '、',
                        ),
                        RubyTextData(
                          '嵐',
                          ruby: 'あらし',
                        ),
                        RubyTextData(
                          'が',
                        ),
                        RubyTextData(
                          '来',
                          ruby: 'き',
                        ),
                        RubyTextData(
                          'た',
                        ),
                        RubyTextData(
                          '呼',
                          ruby: 'よ',
                        ),
                        RubyTextData(
                          '、',
                        ),
                        RubyTextData(
                          'でいごが',
                        ),
                        RubyTextData(
                          '咲',
                          ruby: 'さ',
                        ),
                        RubyTextData(
                          'き',
                        ),
                        RubyTextData(
                          '乱',
                          ruby: 'みだ',
                        ),
                        RubyTextData(
                          'れ',
                        ),
                        RubyTextData(
                          '、',
                        ),
                        RubyTextData(
                          '嵐',
                          ruby: 'あらし',
                        ),
                        RubyTextData(
                          'が',
                        ),
                        RubyTextData(
                          '来',
                          ruby: 'き',
                        ),
                        RubyTextData(
                          'た。',
                        ),
                      ],
                    ),
                  ),
                  Padding(
                    padding: const EdgeInsets.all(16.0),
                    child: RubyText(
                      [
                        RubyTextData(
                          '検査',
                          ruby: 'けんさけんさ',
                        ),
                      ],
                    ),
                  ),
                  Padding(
                    padding: const EdgeInsets.all(16.0),
                    child: RubyText(
                      [
                        RubyTextData(
                          '検査検査',
                          ruby: 'けんさ',
                        ),
                      ],
                    ),
                  ),
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  ruby_text: ^1.0.1

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:ruby_text/ruby_text.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
32
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
66
Learn more about scoring.

We analyzed this package on Jul 9, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • ruby_text that is a package requiring null.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.1
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test