钢琴

一个提供

  • 用于处理音乐**音符**、**谱号**和**八度**的逻辑的 Flutter 包;
  • 一个可以**渲染谱号上的音符**的组件;
  • 一个**交互式钢琴**组件。

它在哪里使用?

在“Learn The Notes”中,一个简单的视唱练习器,你可以在这里的 iOS App Store 和 这里的 macOS App Store 找到。

Example showing musical clef and interactive piano

如何使用它?

这是一个示例应用

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:piano/piano.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return CupertinoApp(
        title: 'Piano Demo',
        home: Center(
          child: InteractivePiano(
            highlightedNotes: [
              NotePosition(note: Note.C, octave: 3)
            ],
            naturalColor: Colors.white,
            accidentalColor: Colors.black,
            keyWidth: 60,
            noteRange: NoteRange.forClefs([
              Clef.Treble,
            ]),
            onNotePositionTapped: (position) {
              // Use an audio library like flutter_midi to play the sound
            },
          ),
        ));
  }
}

GitHub

https://github.com/craigomac/piano