Skip to content

Commit 400e0a5

Browse files
authored
Added symbols icon and fraction key to second page (#26)
1 parent 150d5f2 commit 400e0a5

File tree

7 files changed

+45
-4
lines changed

7 files changed

+45
-4
lines changed

math_keyboard/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.1.3
2+
3+
* Added new symbols icon for functions button.
4+
* Added fraction button to second keyboard page.
5+
16
## 0.1.2
27

38
* Bumped `flutter_math_fork`.
2.13 KB
Binary file not shown.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/// Flutter icons CustomKeyIcons
2+
/// Copyright (C) 2022 by original authors @ fluttericon.com, fontello.com
3+
/// This font was generated by FlutterIcon.com, which is derived from Fontello.
4+
5+
import 'package:flutter/widgets.dart';
6+
7+
/// A collection of custom key icons.
8+
class CustomKeyIcons {
9+
CustomKeyIcons._();
10+
11+
static const _kFontFam = 'CustomKeyIcons';
12+
static const String? _kFontPkg = 'math_keyboard';
13+
14+
/// Key icon used for indicating multiple symbols.
15+
static const IconData key_symbols =
16+
IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg);
17+
}

math_keyboard/lib/src/foundation/keyboard_button.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ const _subtractButton = BasicKeyboardButtonConfig(
115115
/// Keyboard showing extended functionality.
116116
final functionKeyboard = [
117117
[
118+
const BasicKeyboardButtonConfig(
119+
label: r'\frac{\Box}{\Box}',
120+
value: r'\frac',
121+
args: [TeXArg.braces, TeXArg.braces],
122+
asTex: true,
123+
),
118124
const BasicKeyboardButtonConfig(
119125
label: r'\Box^2',
120126
value: '^2',

math_keyboard/lib/src/widgets/math_keyboard.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import 'dart:ui';
33
import 'package:flutter/material.dart';
44
import 'package:flutter/scheduler.dart';
55
import 'package:flutter_math_fork/flutter_math.dart';
6+
import 'package:math_keyboard/src/custom_key_icons/custom_key_icons.dart';
67
import 'package:math_keyboard/src/foundation/keyboard_button.dart';
78
import 'package:math_keyboard/src/widgets/decimal_separator.dart';
89
import 'package:math_keyboard/src/widgets/keyboard_button.dart';
@@ -341,7 +342,10 @@ class _Buttons extends StatelessWidget {
341342
else if (config is PageButtonConfig)
342343
_BasicButton(
343344
flex: config.flex,
344-
label: controller.secondPage ? '123' : 'f(x)',
345+
icon: controller.secondPage
346+
? null
347+
: CustomKeyIcons.key_symbols,
348+
label: controller.secondPage ? '123' : null,
345349
onTap: controller.togglePage,
346350
highlightLevel: 1,
347351
)

math_keyboard/pubspec.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: math_keyboard
22
description: >-2
33
Math expression editing using an on-screen software keyboard or physical keyboard input in a
44
typeset input field in Flutter.
5-
version: 0.1.2
5+
version: 0.1.3
66
homepage: https://github.com/simpleclub/math_keyboard/tree/main/math_keyboard
77

88
environment:
@@ -26,3 +26,9 @@ dev_dependencies:
2626
sdk: flutter
2727

2828
pedantic: ^1.11.0
29+
30+
flutter:
31+
fonts:
32+
- family: CustomKeyIcons
33+
fonts:
34+
- asset: fonts/CustomKeyIcons.ttf

math_keyboard_demo/lib/widgets/app.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ class _DemoAppState extends State<DemoApp> {
2020
title: appTitle,
2121
theme: ThemeData(
2222
brightness: _darkMode ? Brightness.dark : Brightness.light,
23-
primarySwatch: Colors.amber,
24-
accentColor: Colors.amberAccent,
23+
colorScheme: ColorScheme.fromSwatch(
24+
primarySwatch: Colors.amber,
25+
).copyWith(
26+
secondary: Colors.amberAccent,
27+
),
2528
),
2629
home: DemoScaffold(
2730
onToggleBrightness: () {

0 commit comments

Comments
 (0)