-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from 3Dpass/dev
Random rotation bytes
- Loading branch information
Showing
23 changed files
with
282 additions
and
353 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import 'dart:math'; | ||
|
||
class RandomHex { | ||
static const _chars = '1234567890abcdef'; | ||
static final Random _rnd = Random(); | ||
|
||
static String generate(final int length) => String.fromCharCodes( | ||
Iterable.generate( | ||
length, | ||
(final _) => _chars.codeUnitAt( | ||
_rnd.nextInt(_chars.length), | ||
), | ||
), | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...ntation/pages/create_account/create_account_from_object/widgets/choose_hash_dropdown.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
part of '../create_account_from_object.dart'; | ||
|
||
class _ChooseHashDropdown extends StatelessWidget { | ||
const _ChooseHashDropdown({ | ||
required this.objectValueNotifier, | ||
required this.chosenHash, | ||
}); | ||
|
||
final ValueNotifier<HashObject> objectValueNotifier; | ||
final ValueNotifier<String> chosenHash; | ||
|
||
void onHashChoose(final String? value) { | ||
if (value != null) { | ||
chosenHash.value = value; | ||
} | ||
} | ||
|
||
@override | ||
Widget build(final BuildContext context) { | ||
return ValueListenableBuilder( | ||
valueListenable: objectValueNotifier, | ||
builder: (final ___, final _, final __) => ValueListenableBuilder( | ||
valueListenable: chosenHash, | ||
builder: (final context, final _, final __) => DropdownButton<String>( | ||
isExpanded: true, | ||
style: Theme.of(context).textTheme.bodyText1, | ||
value: chosenHash.value, | ||
items: objectValueNotifier.value.stableHashes | ||
.map( | ||
(final e) => DropdownMenuItem<String>( | ||
value: e, | ||
child: Text( | ||
e, | ||
maxLines: 3, | ||
style: Theme.of(context).textTheme.bodyText1, | ||
), | ||
), | ||
) | ||
.toList(), | ||
onChanged: (final String? modelChosen) => onHashChoose(modelChosen), | ||
), | ||
), | ||
); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...esentation/pages/create_account/create_account_from_object/widgets/choose_hash_title.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
part of '../create_account_from_object.dart'; | ||
|
||
class _ChooseHashTitle extends StatelessWidget { | ||
const _ChooseHashTitle(); | ||
|
||
@override | ||
Widget build(final BuildContext context) => Text.rich( | ||
TextSpan( | ||
text: 'create_from_object_text2'.tr(), | ||
style: Theme.of(context).textTheme.headline6, | ||
children: [ | ||
TextSpan( | ||
text: '\n' + 'create_from_object_text2_hint'.tr(), | ||
style: Theme.of(context).textTheme.bodyText1, | ||
), | ||
], | ||
), | ||
); | ||
} |
44 changes: 44 additions & 0 deletions
44
...ation/pages/create_account/create_account_from_object/widgets/choose_object_dropdown.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
part of '../create_account_from_object.dart'; | ||
|
||
class _ChooseObjectDropdown extends StatelessWidget { | ||
const _ChooseObjectDropdown({ | ||
required this.objectValueNotifier, | ||
required this.objectsToUse, | ||
required this.chosenHash, | ||
}); | ||
|
||
final ValueNotifier<HashObject> objectValueNotifier; | ||
final List<HashObject> objectsToUse; | ||
final ValueNotifier<String> chosenHash; | ||
|
||
void onObjectChoose(final HashObject? hashObject) { | ||
if (hashObject != null) { | ||
objectValueNotifier.value = hashObject; | ||
chosenHash.value = hashObject.stableHashes.first; | ||
} | ||
} | ||
|
||
@override | ||
Widget build(final BuildContext context) { | ||
return ValueListenableBuilder( | ||
valueListenable: objectValueNotifier, | ||
builder: (final context, final _, final __) => DropdownButton<HashObject>( | ||
style: Theme.of(context).textTheme.bodyText1, | ||
value: objectValueNotifier.value, | ||
items: objectsToUse | ||
.map( | ||
(final e) => DropdownMenuItem<HashObject>( | ||
value: e, | ||
child: Text( | ||
e.name.cutWithEllipsis(20), | ||
overflow: TextOverflow.ellipsis, | ||
style: Theme.of(context).textTheme.bodyText1, | ||
), | ||
), | ||
) | ||
.toList(), | ||
onChanged: (final modelChosen) => onObjectChoose(modelChosen), | ||
), | ||
); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...entation/pages/create_account/create_account_from_object/widgets/choose_object_title.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
part of '../create_account_from_object.dart'; | ||
|
||
class _ChooseObjectTitle extends StatelessWidget { | ||
const _ChooseObjectTitle(); | ||
|
||
@override | ||
Widget build(final BuildContext context) => Text( | ||
'create_from_object_text1'.tr(), | ||
style: Theme.of(context).textTheme.headline6, | ||
); | ||
} |
Oops, something went wrong.