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