Ontap не работает при выходе за пределы области высоты 250. Я пробовал использовать Inkwell, изменять поведение детектора жестов, использовать поглощающий указатель, но не смог получить никаких результатов. Функции OnTap частей с clip.none не работают. Полупрозрачное поведение или любой виджет не могут решить эту проблему, что мне делать?
import 'package:gap/gap.dart';
import 'package:mubu/core/constants/image_constants.dart';
import 'package:mubu/core/constants/text_styles.dart';
import 'package:mubu/core/extension/context_extension.dart';
import 'package:flutter/material.dart';
class Header extends StatelessWidget {
const Header({
super.key,
});
@override
Widget build(BuildContext context) {
return Stack(
clipBehavior: Clip.none,
alignment: Alignment.bottomCenter,
children: [
Container(
height: 250,
width: double.infinity,
decoration: BoxDecoration(
color: context.primaryColor,
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(20),
bottomRight: Radius.circular(20),
),
),
),
// Left Background Image
Positioned(
top: 45,
left: 0,
child: AbsorbPointer(
child: Image.asset(
ImageConstants.leftBackground,
width: 200,
),
),
),
// Right Background Image
Positioned(
top: 50,
right: 0,
child: Image.asset(
ImageConstants.rightBackground,
width: 95,
),
),
Positioned(
top: 50,
left: 20,
right: 20,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Row(
children: [
CircleAvatar(
radius: 25,
backgroundImage: NetworkImage('https://avatars.githubusercontent.com/u/29775859?v=4'),
),
Gap(17),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Hoşgeldin',
style: TextStyle(color: Colors.white, fontSize: 17, fontWeight: FontWeight.bold, height: 0),
),
Text(
'Hira Aker',
style: TextStyle(
color: Colors.white,
fontSize: 24,
height: 0,
fontWeight: FontWeight.bold,
),
),
],
),
],
),
Stack(
children: [
Image.asset(
ImageConstants.notification,
width: 34,
height: 34,
),
Positioned(
top: 2,
right: 2,
child: Container(
width: 12,
height: 12,
decoration: const BoxDecoration(
color: Color(0xFF13B3B3),
shape: BoxShape.circle,
),
),
),
],
),
],
),
),
Positioned(
top: 130,
left: 20,
right: 20,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
decoration: BoxDecoration(
color: const Color(0xFF6924FC).withOpacity(0.95),
borderRadius: BorderRadius.circular(15),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.3),
blurRadius: 10,
offset: const Offset(0, 3),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Cüzdanım",
style: TextStyles.title.copyWith(color: Colors.white),
),
const Gap(10),
Text(
"Güncel Bakiye",
style: TextStyles.bodyLarge.copyWith(
color: const Color(0XFFFBBE84),
),
),
const Gap(10),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text("₺13.543,56", style: TextStyles.title.copyWith(color: Colors.white)),
Image.asset(
ImageConstants.visibilityOff,
width: 35,
),
],
),
GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
print("data tapped");
},
child: Text("data"))
],
),
),
),
],
);
}
}
Галина
Вопрос задан28 апреля 2024 г.