spelling: chosen
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
This commit is contained in:
parent
c40ae690e3
commit
380a1670f0
@ -6,7 +6,7 @@ import 'package:flutter_hbb/models/platform_model.dart';
|
|||||||
|
|
||||||
import '../../common.dart';
|
import '../../common.dart';
|
||||||
|
|
||||||
typedef KBChoosedCallback = Future<bool> Function(String);
|
typedef KBChosenCallback = Future<bool> Function(String);
|
||||||
|
|
||||||
const double _kImageMarginVertical = 6.0;
|
const double _kImageMarginVertical = 6.0;
|
||||||
const double _kImageMarginHorizontal = 10.0;
|
const double _kImageMarginHorizontal = 10.0;
|
||||||
@ -25,12 +25,12 @@ const _kKBLayoutImageMap = {
|
|||||||
class _KBImage extends StatelessWidget {
|
class _KBImage extends StatelessWidget {
|
||||||
final String kbLayoutType;
|
final String kbLayoutType;
|
||||||
final double imageWidth;
|
final double imageWidth;
|
||||||
final RxString choosedType;
|
final RxString chosenType;
|
||||||
const _KBImage({
|
const _KBImage({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.kbLayoutType,
|
required this.kbLayoutType,
|
||||||
required this.imageWidth,
|
required this.imageWidth,
|
||||||
required this.choosedType,
|
required this.chosenType,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -40,7 +40,7 @@ class _KBImage extends StatelessWidget {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(_kBorderRadius),
|
borderRadius: BorderRadius.circular(_kBorderRadius),
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color: choosedType.value == kbLayoutType
|
color: chosenType.value == kbLayoutType
|
||||||
? _kImageBorderColor
|
? _kImageBorderColor
|
||||||
: Colors.transparent,
|
: Colors.transparent,
|
||||||
width: _kImageBoarderWidth,
|
width: _kImageBoarderWidth,
|
||||||
@ -66,13 +66,13 @@ class _KBImage extends StatelessWidget {
|
|||||||
class _KBChooser extends StatelessWidget {
|
class _KBChooser extends StatelessWidget {
|
||||||
final String kbLayoutType;
|
final String kbLayoutType;
|
||||||
final double imageWidth;
|
final double imageWidth;
|
||||||
final RxString choosedType;
|
final RxString chosenType;
|
||||||
final KBChoosedCallback cb;
|
final KBChosenCallback cb;
|
||||||
const _KBChooser({
|
const _KBChooser({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.kbLayoutType,
|
required this.kbLayoutType,
|
||||||
required this.imageWidth,
|
required this.imageWidth,
|
||||||
required this.choosedType,
|
required this.chosenType,
|
||||||
required this.cb,
|
required this.cb,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ class _KBChooser extends StatelessWidget {
|
|||||||
onChanged(String? v) async {
|
onChanged(String? v) async {
|
||||||
if (v != null) {
|
if (v != null) {
|
||||||
if (await cb(v)) {
|
if (await cb(v)) {
|
||||||
choosedType.value = v;
|
chosenType.value = v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -95,7 +95,7 @@ class _KBChooser extends StatelessWidget {
|
|||||||
child: _KBImage(
|
child: _KBImage(
|
||||||
kbLayoutType: kbLayoutType,
|
kbLayoutType: kbLayoutType,
|
||||||
imageWidth: imageWidth,
|
imageWidth: imageWidth,
|
||||||
choosedType: choosedType,
|
chosenType: chosenType,
|
||||||
),
|
),
|
||||||
style: TextButton.styleFrom(padding: EdgeInsets.zero),
|
style: TextButton.styleFrom(padding: EdgeInsets.zero),
|
||||||
),
|
),
|
||||||
@ -105,7 +105,7 @@ class _KBChooser extends StatelessWidget {
|
|||||||
Obx(() => Radio(
|
Obx(() => Radio(
|
||||||
splashRadius: 0,
|
splashRadius: 0,
|
||||||
value: kbLayoutType,
|
value: kbLayoutType,
|
||||||
groupValue: choosedType.value,
|
groupValue: chosenType.value,
|
||||||
onChanged: onChanged,
|
onChanged: onChanged,
|
||||||
)),
|
)),
|
||||||
Text(kbLayoutType),
|
Text(kbLayoutType),
|
||||||
@ -121,14 +121,14 @@ class _KBChooser extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class KBLayoutTypeChooser extends StatelessWidget {
|
class KBLayoutTypeChooser extends StatelessWidget {
|
||||||
final RxString choosedType;
|
final RxString chosenType;
|
||||||
final double width;
|
final double width;
|
||||||
final double height;
|
final double height;
|
||||||
final double dividerWidth;
|
final double dividerWidth;
|
||||||
final KBChoosedCallback cb;
|
final KBChosenCallback cb;
|
||||||
KBLayoutTypeChooser({
|
KBLayoutTypeChooser({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.choosedType,
|
required this.chosenType,
|
||||||
required this.width,
|
required this.width,
|
||||||
required this.height,
|
required this.height,
|
||||||
required this.dividerWidth,
|
required this.dividerWidth,
|
||||||
@ -147,7 +147,7 @@ class KBLayoutTypeChooser extends StatelessWidget {
|
|||||||
_KBChooser(
|
_KBChooser(
|
||||||
kbLayoutType: _kKBLayoutTypeISO,
|
kbLayoutType: _kKBLayoutTypeISO,
|
||||||
imageWidth: imageWidth,
|
imageWidth: imageWidth,
|
||||||
choosedType: choosedType,
|
chosenType: chosenType,
|
||||||
cb: cb,
|
cb: cb,
|
||||||
),
|
),
|
||||||
VerticalDivider(
|
VerticalDivider(
|
||||||
@ -156,7 +156,7 @@ class KBLayoutTypeChooser extends StatelessWidget {
|
|||||||
_KBChooser(
|
_KBChooser(
|
||||||
kbLayoutType: _kKBLayoutTypeNotISO,
|
kbLayoutType: _kKBLayoutTypeNotISO,
|
||||||
imageWidth: imageWidth,
|
imageWidth: imageWidth,
|
||||||
choosedType: choosedType,
|
chosenType: chosenType,
|
||||||
cb: cb,
|
cb: cb,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -208,7 +208,7 @@ showKBLayoutTypeChooser(
|
|||||||
title:
|
title:
|
||||||
Text('${translate('Select local keyboard type')} ($localPlatform)'),
|
Text('${translate('Select local keyboard type')} ($localPlatform)'),
|
||||||
content: KBLayoutTypeChooser(
|
content: KBLayoutTypeChooser(
|
||||||
choosedType: KBLayoutType,
|
chosenType: KBLayoutType,
|
||||||
width: 360,
|
width: 360,
|
||||||
height: 200,
|
height: 200,
|
||||||
dividerWidth: 4.0,
|
dividerWidth: 4.0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user