diff --git a/math_keyboard/CHANGELOG.md b/math_keyboard/CHANGELOG.md index a64e30a..8ebe73d 100644 --- a/math_keyboard/CHANGELOG.md +++ b/math_keyboard/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.1.3 + +* Added new symbols icon for functions button. +* Added fraction button to second keyboard page. + ## 0.1.2 * Bumped `flutter_math_fork`. diff --git a/math_keyboard/fonts/CustomKeyIcons.ttf b/math_keyboard/fonts/CustomKeyIcons.ttf new file mode 100644 index 0000000..6a5a661 Binary files /dev/null and b/math_keyboard/fonts/CustomKeyIcons.ttf differ diff --git a/math_keyboard/lib/src/custom_key_icons/custom_key_icons.dart b/math_keyboard/lib/src/custom_key_icons/custom_key_icons.dart new file mode 100644 index 0000000..d630e1b --- /dev/null +++ b/math_keyboard/lib/src/custom_key_icons/custom_key_icons.dart @@ -0,0 +1,17 @@ +/// Flutter icons CustomKeyIcons +/// Copyright (C) 2022 by original authors @ fluttericon.com, fontello.com +/// This font was generated by FlutterIcon.com, which is derived from Fontello. + +import 'package:flutter/widgets.dart'; + +/// A collection of custom key icons. +class CustomKeyIcons { + CustomKeyIcons._(); + + static const _kFontFam = 'CustomKeyIcons'; + static const String? _kFontPkg = 'math_keyboard'; + + /// Key icon used for indicating multiple symbols. + static const IconData key_symbols = + IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg); +} diff --git a/math_keyboard/lib/src/foundation/keyboard_button.dart b/math_keyboard/lib/src/foundation/keyboard_button.dart index b7070cf..3784c86 100644 --- a/math_keyboard/lib/src/foundation/keyboard_button.dart +++ b/math_keyboard/lib/src/foundation/keyboard_button.dart @@ -115,6 +115,12 @@ const _subtractButton = BasicKeyboardButtonConfig( /// Keyboard showing extended functionality. final functionKeyboard = [ [ + const BasicKeyboardButtonConfig( + label: r'\frac{\Box}{\Box}', + value: r'\frac', + args: [TeXArg.braces, TeXArg.braces], + asTex: true, + ), const BasicKeyboardButtonConfig( label: r'\Box^2', value: '^2', diff --git a/math_keyboard/lib/src/widgets/math_keyboard.dart b/math_keyboard/lib/src/widgets/math_keyboard.dart index 8e7e28c..e9ff2b9 100644 --- a/math_keyboard/lib/src/widgets/math_keyboard.dart +++ b/math_keyboard/lib/src/widgets/math_keyboard.dart @@ -3,6 +3,7 @@ import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; import 'package:flutter_math_fork/flutter_math.dart'; +import 'package:math_keyboard/src/custom_key_icons/custom_key_icons.dart'; import 'package:math_keyboard/src/foundation/keyboard_button.dart'; import 'package:math_keyboard/src/widgets/decimal_separator.dart'; import 'package:math_keyboard/src/widgets/keyboard_button.dart'; @@ -341,7 +342,10 @@ class _Buttons extends StatelessWidget { else if (config is PageButtonConfig) _BasicButton( flex: config.flex, - label: controller.secondPage ? '123' : 'f(x)', + icon: controller.secondPage + ? null + : CustomKeyIcons.key_symbols, + label: controller.secondPage ? '123' : null, onTap: controller.togglePage, highlightLevel: 1, ) diff --git a/math_keyboard/pubspec.yaml b/math_keyboard/pubspec.yaml index 23514e8..3d3ff1e 100644 --- a/math_keyboard/pubspec.yaml +++ b/math_keyboard/pubspec.yaml @@ -2,7 +2,7 @@ name: math_keyboard description: >-2 Math expression editing using an on-screen software keyboard or physical keyboard input in a typeset input field in Flutter. -version: 0.1.2 +version: 0.1.3 homepage: https://github.com/simpleclub/math_keyboard/tree/main/math_keyboard environment: @@ -26,3 +26,9 @@ dev_dependencies: sdk: flutter pedantic: ^1.11.0 + +flutter: + fonts: + - family: CustomKeyIcons + fonts: + - asset: fonts/CustomKeyIcons.ttf diff --git a/math_keyboard_demo/lib/widgets/app.dart b/math_keyboard_demo/lib/widgets/app.dart index 02ce546..1b61289 100644 --- a/math_keyboard_demo/lib/widgets/app.dart +++ b/math_keyboard_demo/lib/widgets/app.dart @@ -20,8 +20,11 @@ class _DemoAppState extends State { title: appTitle, theme: ThemeData( brightness: _darkMode ? Brightness.dark : Brightness.light, - primarySwatch: Colors.amber, - accentColor: Colors.amberAccent, + colorScheme: ColorScheme.fromSwatch( + primarySwatch: Colors.amber, + ).copyWith( + secondary: Colors.amberAccent, + ), ), home: DemoScaffold( onToggleBrightness: () {