fix & opt.
This commit is contained in:
@@ -3,7 +3,6 @@ import 'package:provider/provider.dart';
|
||||
import 'package:toolbox/core/route.dart';
|
||||
import 'package:toolbox/data/provider/private_key.dart';
|
||||
import 'package:toolbox/data/res/font_style.dart';
|
||||
import 'package:toolbox/data/res/padding.dart';
|
||||
import 'package:toolbox/generated/l10n.dart';
|
||||
import 'package:toolbox/view/page/private_key/edit.dart';
|
||||
import 'package:toolbox/view/widget/round_rect_card.dart';
|
||||
@@ -32,36 +31,31 @@ class _PrivateKeyListState extends State<StoredPrivateKeysPage> {
|
||||
),
|
||||
body: Consumer<PrivateKeyProvider>(
|
||||
builder: (_, key, __) {
|
||||
return key.infos.isNotEmpty
|
||||
? ListView.builder(
|
||||
padding: const EdgeInsets.all(13),
|
||||
itemCount: key.infos.length,
|
||||
itemExtent: 57,
|
||||
itemBuilder: (context, idx) {
|
||||
return RoundRectCard(Padding(
|
||||
padding: roundRectCardPadding,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
key.infos[idx].id,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => AppRoute(
|
||||
PrivateKeyEditPage(info: key.infos[idx]),
|
||||
'private key edit page')
|
||||
.go(context),
|
||||
child: Text(_s.edit),
|
||||
)
|
||||
],
|
||||
),
|
||||
));
|
||||
})
|
||||
: Center(
|
||||
child: Text(_s.noSavedPrivateKey),
|
||||
);
|
||||
if (key.infos.isEmpty) {
|
||||
return Center(
|
||||
child: Text(_s.noSavedPrivateKey),
|
||||
);
|
||||
}
|
||||
return ListView.builder(
|
||||
padding: const EdgeInsets.all(13),
|
||||
itemCount: key.infos.length,
|
||||
itemBuilder: (context, idx) {
|
||||
return RoundRectCard(
|
||||
ListTile(
|
||||
title: Text(
|
||||
key.infos[idx].id,
|
||||
),
|
||||
trailing: TextButton(
|
||||
onPressed: () => AppRoute(
|
||||
PrivateKeyEditPage(info: key.infos[idx]),
|
||||
'private key edit page')
|
||||
.go(context),
|
||||
child: Text(_s.edit),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
|
||||
Reference in New Issue
Block a user