fix: Use animatedswitcher instead of crashing animatedcrossfade
This commit is contained in:
parent
565926809d
commit
85139f533c
2 changed files with 172 additions and 170 deletions
|
|
@ -99,15 +99,14 @@ class NewPrivateChatView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: AnimatedCrossFade(
|
child: AnimatedSwitcher(
|
||||||
duration: FluffyThemes.animationDuration,
|
duration: FluffyThemes.animationDuration,
|
||||||
crossFadeState: searchResponse == null
|
child: searchResponse == null
|
||||||
? CrossFadeState.showFirst
|
? ListView(
|
||||||
: CrossFadeState.showSecond,
|
|
||||||
firstChild: ListView(
|
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 18.0),
|
padding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 18.0),
|
||||||
child: SelectableText.rich(
|
child: SelectableText.rich(
|
||||||
TextSpan(
|
TextSpan(
|
||||||
children: [
|
children: [
|
||||||
|
|
@ -131,8 +130,10 @@ class NewPrivateChatView extends StatelessWidget {
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: CircleAvatar(
|
leading: CircleAvatar(
|
||||||
backgroundColor: theme.colorScheme.secondaryContainer,
|
backgroundColor:
|
||||||
foregroundColor: theme.colorScheme.onSecondaryContainer,
|
theme.colorScheme.secondaryContainer,
|
||||||
|
foregroundColor:
|
||||||
|
theme.colorScheme.onSecondaryContainer,
|
||||||
child: Icon(Icons.adaptive.share_outlined),
|
child: Icon(Icons.adaptive.share_outlined),
|
||||||
),
|
),
|
||||||
title: Text(L10n.of(context).shareInviteLink),
|
title: Text(L10n.of(context).shareInviteLink),
|
||||||
|
|
@ -140,8 +141,10 @@ class NewPrivateChatView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: CircleAvatar(
|
leading: CircleAvatar(
|
||||||
backgroundColor: theme.colorScheme.tertiaryContainer,
|
backgroundColor:
|
||||||
foregroundColor: theme.colorScheme.onTertiaryContainer,
|
theme.colorScheme.tertiaryContainer,
|
||||||
|
foregroundColor:
|
||||||
|
theme.colorScheme.onTertiaryContainer,
|
||||||
child: const Icon(Icons.group_add_outlined),
|
child: const Icon(Icons.group_add_outlined),
|
||||||
),
|
),
|
||||||
title: Text(L10n.of(context).createGroup),
|
title: Text(L10n.of(context).createGroup),
|
||||||
|
|
@ -150,9 +153,12 @@ class NewPrivateChatView extends StatelessWidget {
|
||||||
if (PlatformInfos.isMobile)
|
if (PlatformInfos.isMobile)
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: CircleAvatar(
|
leading: CircleAvatar(
|
||||||
backgroundColor: theme.colorScheme.primaryContainer,
|
backgroundColor:
|
||||||
foregroundColor: theme.colorScheme.onPrimaryContainer,
|
theme.colorScheme.primaryContainer,
|
||||||
child: const Icon(Icons.qr_code_scanner_outlined),
|
foregroundColor:
|
||||||
|
theme.colorScheme.onPrimaryContainer,
|
||||||
|
child:
|
||||||
|
const Icon(Icons.qr_code_scanner_outlined),
|
||||||
),
|
),
|
||||||
title: Text(L10n.of(context).scanQrCode),
|
title: Text(L10n.of(context).scanQrCode),
|
||||||
onTap: controller.openScannerAction,
|
onTap: controller.openScannerAction,
|
||||||
|
|
@ -165,8 +171,9 @@ class NewPrivateChatView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
child: Material(
|
child: Material(
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius:
|
borderRadius: BorderRadius.circular(
|
||||||
BorderRadius.circular(AppConfig.borderRadius),
|
AppConfig.borderRadius,
|
||||||
|
),
|
||||||
side: BorderSide(
|
side: BorderSide(
|
||||||
width: 3,
|
width: 3,
|
||||||
color: theme.colorScheme.primary,
|
color: theme.colorScheme.primary,
|
||||||
|
|
@ -175,8 +182,9 @@ class NewPrivateChatView extends StatelessWidget {
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
borderRadius:
|
borderRadius: BorderRadius.circular(
|
||||||
BorderRadius.circular(AppConfig.borderRadius),
|
AppConfig.borderRadius,
|
||||||
|
),
|
||||||
onTap: () => showQrCodeViewer(
|
onTap: () => showQrCodeViewer(
|
||||||
context,
|
context,
|
||||||
userId,
|
userId,
|
||||||
|
|
@ -202,8 +210,8 @@ class NewPrivateChatView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
)
|
||||||
secondChild: FutureBuilder(
|
: FutureBuilder(
|
||||||
future: searchResponse,
|
future: searchResponse,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
final result = snapshot.data;
|
final result = snapshot.data;
|
||||||
|
|
|
||||||
|
|
@ -140,12 +140,9 @@ class _MxcImageState extends State<MxcImage> {
|
||||||
final data = _imageData;
|
final data = _imageData;
|
||||||
final hasData = data != null && data.isNotEmpty;
|
final hasData = data != null && data.isNotEmpty;
|
||||||
|
|
||||||
return AnimatedCrossFade(
|
return AnimatedSwitcher(
|
||||||
crossFadeState:
|
|
||||||
hasData ? CrossFadeState.showSecond : CrossFadeState.showFirst,
|
|
||||||
duration: const Duration(milliseconds: 128),
|
duration: const Duration(milliseconds: 128),
|
||||||
firstChild: placeholder(context),
|
child: hasData
|
||||||
secondChild: hasData
|
|
||||||
? Image.memory(
|
? Image.memory(
|
||||||
data,
|
data,
|
||||||
width: widget.width,
|
width: widget.width,
|
||||||
|
|
@ -169,10 +166,7 @@ class _MxcImageState extends State<MxcImage> {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
: SizedBox(
|
: placeholder(context),
|
||||||
width: widget.width,
|
|
||||||
height: widget.height,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue