Skip to content
Snippets Groups Projects
Commit 980d4d42 authored by vjrj's avatar vjrj
Browse files

Card icon for cesium. Card rename feedback

parent 8c0d6a24
No related branches found
No related tags found
No related merge requests found
...@@ -44,7 +44,7 @@ class _CardNameEditableState extends State<CardNameEditable> { ...@@ -44,7 +44,7 @@ class _CardNameEditableState extends State<CardNameEditable> {
'currentText: $currentText, localUsername: $localUsername, _previousValue: $_previousValue, retrieved_name: $name'); 'currentText: $currentText, localUsername: $localUsername, _previousValue: $_previousValue, retrieved_name: $name');
if (localUsername != name) { if (localUsername != name) {
if (name != null) { if (name != null) {
name = name.replaceAll(userNameSuffix, ''); name = name.replaceAll(g1nkgoUserNameSuffix, '');
_controller.text = name; _controller.text = name;
currentText = name; currentText = name;
SharedPreferencesHelper().setName(name: name, notify: false); SharedPreferencesHelper().setName(name: name, notify: false);
...@@ -106,7 +106,7 @@ class _CardNameEditableState extends State<CardNameEditable> { ...@@ -106,7 +106,7 @@ class _CardNameEditableState extends State<CardNameEditable> {
focusedBorder: const OutlineInputBorder( focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(width: 2.0), borderSide: BorderSide(width: 2.0),
), ),
suffix: const Text('$userNameSuffix '), suffix: const Text('$g1nkgoUserNameSuffix '),
suffixIcon: _isSubmitting suffixIcon: _isSubmitting
? const RefreshProgressIndicator() ? const RefreshProgressIndicator()
: Row( : Row(
...@@ -177,6 +177,14 @@ class _CardNameEditableState extends State<CardNameEditable> { ...@@ -177,6 +177,14 @@ class _CardNameEditableState extends State<CardNameEditable> {
}); });
if (_validate(newValue)) { if (_validate(newValue)) {
await createOrUpdateCesiumPlusUser(newValue); await createOrUpdateCesiumPlusUser(newValue);
if (!context.mounted) {
return;
}
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(tr('card_name_changed')),
),
);
setState(() { setState(() {
_previousValue = newValue; _previousValue = newValue;
currentText = newValue; currentText = newValue;
...@@ -269,11 +277,11 @@ class CardNameText extends StatelessWidget { ...@@ -269,11 +277,11 @@ class CardNameText extends StatelessWidget {
TextSpan( TextSpan(
text: currentText, text: currentText,
style: cardTextStyle(context, fontSize: 15)), style: cardTextStyle(context, fontSize: 15)),
if (currentText.isNotEmpty && if (currentText.isNotEmpty && currentText != defValue)
currentText != defValue &&
isGinkgoCard)
TextSpan( TextSpan(
text: userNameSuffix, text: isGinkgoCard
? g1nkgoUserNameSuffix
: protectedUserNameSuffix,
style: cardTextStyle(context, fontSize: 12), style: cardTextStyle(context, fontSize: 12),
), ),
], ],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment