refactor: Update to Dart 3.10 with . shorthands
This commit is contained in:
parent
75a37f3f7c
commit
1ea649f01e
167 changed files with 3351 additions and 3912 deletions
|
|
@ -34,10 +34,10 @@ class Settings3PidController extends State<Settings3Pid> {
|
|||
final response = await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => Matrix.of(context).client.requestTokenToRegisterEmail(
|
||||
clientSecret,
|
||||
input,
|
||||
Settings3Pid.sendAttempt++,
|
||||
),
|
||||
clientSecret,
|
||||
input,
|
||||
Settings3Pid.sendAttempt++,
|
||||
),
|
||||
);
|
||||
if (response.error != null) return;
|
||||
final ok = await showOkAlertDialog(
|
||||
|
|
@ -52,12 +52,10 @@ class Settings3PidController extends State<Settings3Pid> {
|
|||
context: context,
|
||||
delay: false,
|
||||
future: () => Matrix.of(context).client.uiaRequestBackground(
|
||||
(auth) => Matrix.of(context).client.add3PID(
|
||||
clientSecret,
|
||||
response.result!.sid,
|
||||
auth: auth,
|
||||
),
|
||||
),
|
||||
(auth) => Matrix.of(
|
||||
context,
|
||||
).client.add3PID(clientSecret, response.result!.sid, auth: auth),
|
||||
),
|
||||
);
|
||||
if (success.error != null) return;
|
||||
setState(() => request = null);
|
||||
|
|
@ -78,10 +76,9 @@ class Settings3PidController extends State<Settings3Pid> {
|
|||
}
|
||||
final success = await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => Matrix.of(context).client.delete3pidFromAccount(
|
||||
identifier.address,
|
||||
identifier.medium,
|
||||
),
|
||||
future: () => Matrix.of(
|
||||
context,
|
||||
).client.delete3pidFromAccount(identifier.address, identifier.medium),
|
||||
);
|
||||
if (success.error != null) return;
|
||||
setState(() => request = null);
|
||||
|
|
|
|||
|
|
@ -33,67 +33,71 @@ class Settings3PidView extends StatelessWidget {
|
|||
withScrolling: false,
|
||||
child: FutureBuilder<List<ThirdPartyIdentifier>?>(
|
||||
future: controller.request,
|
||||
builder: (
|
||||
BuildContext context,
|
||||
AsyncSnapshot<List<ThirdPartyIdentifier>?> snapshot,
|
||||
) {
|
||||
if (snapshot.hasError) {
|
||||
return Center(
|
||||
child: Text(
|
||||
snapshot.error.toString(),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
);
|
||||
}
|
||||
if (!snapshot.hasData) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator.adaptive(strokeWidth: 2),
|
||||
);
|
||||
}
|
||||
final identifier = snapshot.data!;
|
||||
return Column(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: CircleAvatar(
|
||||
backgroundColor: theme.scaffoldBackgroundColor,
|
||||
foregroundColor:
|
||||
identifier.isEmpty ? Colors.orange : Colors.grey,
|
||||
child: Icon(
|
||||
identifier.isEmpty
|
||||
? Icons.warning_outlined
|
||||
: Icons.info_outlined,
|
||||
builder:
|
||||
(
|
||||
BuildContext context,
|
||||
AsyncSnapshot<List<ThirdPartyIdentifier>?> snapshot,
|
||||
) {
|
||||
if (snapshot.hasError) {
|
||||
return Center(
|
||||
child: Text(
|
||||
snapshot.error.toString(),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
title: Text(
|
||||
identifier.isEmpty
|
||||
? L10n.of(context).noPasswordRecoveryDescription
|
||||
: L10n.of(context)
|
||||
.withTheseAddressesRecoveryDescription,
|
||||
),
|
||||
),
|
||||
const Divider(),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: identifier.length,
|
||||
itemBuilder: (BuildContext context, int i) => ListTile(
|
||||
);
|
||||
}
|
||||
if (!snapshot.hasData) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator.adaptive(strokeWidth: 2),
|
||||
);
|
||||
}
|
||||
final identifier = snapshot.data!;
|
||||
return Column(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: CircleAvatar(
|
||||
backgroundColor: theme.scaffoldBackgroundColor,
|
||||
foregroundColor: Colors.grey,
|
||||
child: Icon(identifier[i].iconData),
|
||||
foregroundColor: identifier.isEmpty
|
||||
? Colors.orange
|
||||
: Colors.grey,
|
||||
child: Icon(
|
||||
identifier.isEmpty
|
||||
? Icons.warning_outlined
|
||||
: Icons.info_outlined,
|
||||
),
|
||||
),
|
||||
title: Text(identifier[i].address),
|
||||
trailing: IconButton(
|
||||
tooltip: L10n.of(context).delete,
|
||||
icon: const Icon(Icons.delete_forever_outlined),
|
||||
color: Colors.red,
|
||||
onPressed: () => controller.delete3Pid(identifier[i]),
|
||||
title: Text(
|
||||
identifier.isEmpty
|
||||
? L10n.of(context).noPasswordRecoveryDescription
|
||||
: L10n.of(
|
||||
context,
|
||||
).withTheseAddressesRecoveryDescription,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
const Divider(),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: identifier.length,
|
||||
itemBuilder: (BuildContext context, int i) => ListTile(
|
||||
leading: CircleAvatar(
|
||||
backgroundColor: theme.scaffoldBackgroundColor,
|
||||
foregroundColor: Colors.grey,
|
||||
child: Icon(identifier[i].iconData),
|
||||
),
|
||||
title: Text(identifier[i].address),
|
||||
trailing: IconButton(
|
||||
tooltip: L10n.of(context).delete,
|
||||
icon: const Icon(Icons.delete_forever_outlined),
|
||||
color: Colors.red,
|
||||
onPressed: () =>
|
||||
controller.delete3Pid(identifier[i]),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue