I've got a screen with yandex map and sliding up panel with many input texts inside and while Im operating with it (e.g. typing text into textfields) app may crash with an SIGABRT signal but may not, it only occurs when I have my sliding up panel open.
Full code:
import 'package:bilbord/dbMethods.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:yandex_mapkit/yandex_mapkit.dart';
import 'package:sliding_up_panel/sliding_up_panel.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
class ControlButton extends StatelessWidget {
const ControlButton({
Key? key,
required this.onPressed,
required this.title
}) : super(key: key);
final VoidCallback onPressed;
final String title;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: ElevatedButton(
onPressed: onPressed,
child: Text(title, textAlign: TextAlign.center),
),
);
}
}
abstract class MapPage extends StatelessWidget {
const MapPage(this.title,);
final String title;
}
class UserLayerPage extends MapPage {
const UserLayerPage({required this.point}) : super('Карта');
final Point point;
@override
Widget build(BuildContext context) {
return _UserLayerExample(position: point);
}
}
class _UserLayerExample extends StatefulWidget {
final Point position;
const _UserLayerExample({Key? key, required this.position}): super(key: key);
@override
_UserLayerExampleState createState() => _UserLayerExampleState();
}
class _UserLayerExampleState extends State<_UserLayerExample> {
TextEditingController firm = TextEditingController();
TextEditingController construction = TextEditingController();
TextEditingController demonstration = TextEditingController();
TextEditingController width = TextEditingController();
TextEditingController height = TextEditingController();
TextEditingController address = TextEditingController();
int positionRating = -1;
int colorRating = -1;
int passabilityRating = -1;
int typeRating = -1;
bool active = true;
CameraPosition? _point;
@override
void dispose() {
firm.dispose();
construction.dispose();
demonstration.dispose();
width.dispose();
height.dispose();
address.dispose();
super.dispose();
}
late YandexMapController controller;
Future<bool> get locationPermissionNotGranted async => !(await Permission.location.request().isGranted);
void _showMessage(BuildContext context, Text text) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: text));
}
List<MapObject> mapObjects = [];
Future<void> getUserPoint() async {
await controller.toggleUserLayer(visible: true);
print(await controller.getUserCameraPosition());
final CameraPosition? _userPosition = await controller.getUserCameraPosition();
await controller.moveCamera(
CameraUpdate.newCameraPosition(
CameraPosition(
target: _userPosition!.target,
),
),
animation: const MapAnimation(type: MapAnimationType.smooth, duration: 1.0)
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(
child: Stack(
alignment: Alignment.bottomRight,
children: [
YandexMap(
onMapCreated: (YandexMapController yandexMapController) async {
controller = yandexMapController;
controller.moveCamera(
CameraUpdate.newCameraPosition(
CameraPosition(
target: widget.position,
),
),
animation: const MapAnimation(type: MapAnimationType.smooth, duration: 1.0)
);
},
mapObjects: mapObjects,
onUserLocationAdded: (UserLocationView view) async {
return view.copyWith(
pin: view.pin.copyWith(
icon: PlacemarkIcon.single(
PlacemarkIconStyle(image: BitmapDescriptor.fromAssetImage('lib/assets/user.png'))
)
),
arrow: view.arrow.copyWith(
icon: PlacemarkIcon.single(
PlacemarkIconStyle(image: BitmapDescriptor.fromAssetImage('lib/assets/arrow.png'))
)
),
accuracyCircle: view.accuracyCircle.copyWith(
fillColor: Colors.green.withOpacity(0.5)
)
);
},
),
Padding(
padding: const EdgeInsets.all(12.0),
child: Visibility(
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
FloatingActionButton(
heroTag: "showMe",
onPressed: () async {
if (await locationPermissionNotGranted) {
_showMessage(context, const Text('Необходимо разрешение на использование местоположения'));
return;
}
await getUserPoint();
},
child: const Icon(Icons.gps_fixed_rounded),
),
const SizedBox(height: 10,),
FloatingActionButton(
heroTag: "putPlacemark",
onPressed: () async {
_point = await controller.getCameraPosition();
final placemark = Placemark(
mapId: const MapObjectId('placemark'),
point: _point!.target,
);
setState(() {
//mapObjects.clear();
mapObjects.add(placemark);
});
print(_point?.target.longitude);
print(mapObjects.length);
},
child: const Icon(Icons.add),
),
const SizedBox(height: 10,),
const SizedBox(
height: 30,
)
],
),
),
),
const Center(
child: Icon(Icons.gps_fixed_rounded),
),
]
)
),
SlidingUpPanel(
maxHeight: MediaQuery.of(context).size.height,
minHeight: 40.0,
parallaxEnabled: true,
parallaxOffset: .1,
header: SizedBox(
child: Row(
children:const [
Icon(Icons.drag_handle)
],
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
),
width: MediaQuery.of(context).size.width,
),
panelBuilder: (sc) => Padding(
padding: const EdgeInsets.only(top: 50.0),
child: _InputPanel(sc),
),
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(18.0),
topRight: Radius.circular(18.0)
)
)
]
),
);
}
Widget _InputPanel(ScrollController sc){
return SingleChildScrollView(
controller: sc,
child: Column(
children: [
const SizedBox(height: 15,),
TextField(
controller: firm,
decoration: inputDecoration("Фирма"),
),
const SizedBox(height: 10,),
TextField(
controller: construction,
decoration: inputDecoration('Тип конструкции'),
),
const SizedBox(height: 10,),
TextField(
controller: demonstration,
decoration: inputDecoration('Тип демонстрации'),
),
const SizedBox(height: 10,),
Row(
children: [
Expanded(
child: TextField(
controller: width,
keyboardType: TextInputType.number,
decoration: inputDecoration('Ширина'),
),
),
const SizedBox(width: 5,),
Expanded(
child: TextField(
controller: height,
keyboardType: TextInputType.number,
decoration: inputDecoration('Высота'),
),
),
],
),
const SizedBox(height: 10,),
TextField(
controller: address,
decoration: inputDecoration('Адрес'),
),
const SizedBox(height: 10,),
const Text("Оценка позиции: "),
RatingBar.builder(
initialRating: 0,
minRating: 1,
direction: Axis.horizontal,
allowHalfRating: false,
itemCount: 5,
itemPadding: const EdgeInsets.symmetric(horizontal: 6.0),
itemBuilder: (context, _) => const Icon(
Icons.star,
color: Colors.amber,
),
onRatingUpdate: (rating) {
positionRating = rating.round();
},
),
const SizedBox(height: 10,),
const Text("Оценка цвета: "),
RatingBar.builder(
initialRating: 0,
minRating: 1,
direction: Axis.horizontal,
allowHalfRating: false,
itemCount: 5,
itemPadding: const EdgeInsets.symmetric(horizontal: 6.0),
itemBuilder: (context, _) => const Icon(
Icons.star,
color: Colors.amber,
),
onRatingUpdate: (rating) {
colorRating = rating.round();
},
),
const SizedBox(height: 10,),
const Text("Оценка проходимости: "),
RatingBar.builder(
initialRating: 0,
minRating: 1,
direction: Axis.horizontal,
allowHalfRating: false,
itemCount: 5,
itemPadding: const EdgeInsets.symmetric(horizontal: 6.0),
itemBuilder: (context, _) => const Icon(
Icons.star,
color: Colors.amber,
),
onRatingUpdate: (rating) {
passabilityRating = rating.round();
},
),
const SizedBox(height: 10,),
const Text("Оценка типа баннера: "),
RatingBar.builder(
initialRating: 0,
minRating: 1,
direction: Axis.horizontal,
allowHalfRating: false,
itemCount: 5,
itemPadding: const EdgeInsets.symmetric(horizontal: 6.0),
itemBuilder: (context, _) => const Icon(
Icons.star,
color: Colors.amber,
),
onRatingUpdate: (rating) {
typeRating = rating.round();
},
),
ElevatedButton(
onPressed: () => active ? () => _addBilbord(firm.text, construction.text, demonstration.text, width.text as double, height.text as double, address.text, positionRating, colorRating, passabilityRating, typeRating, _point!.target.longitude, _point!.target.latitude) : null,
child: const Text("Добавить билборд")
)
],
),
);
}
Future<int> _addBilbord(String firm, String construction, String demonstration, double width, double height, String address, int positionRating, int colorRating, int passabilityRating, int typeRating, double lat, double long) async{
active = false;
var db = dbMethods();
await db.getConnection().then((conn) async {
await Future.delayed(const Duration(seconds: 1));
var result = await conn.query('INSERT INTO info '
'(user, '
'bannerfirm, '
'construction_type,'
'demonstration_type, '
'lat,'
'long,'
'sizeX, '
'sizeY, '
'address, '
'positionRate,'
' colorsRate,'
' passabilityRate,'
' typeRate'
') VALUES '
'(1, "${firm}", "${construction}","${demonstration}",${lat}, ${long}, ${width}, ${height}, "${address}", ${positionRating},${colorRating}, ${passabilityRating}, ${typeRating});');
active = true;
print(result.insertId ?? -1);
conn.close();
return (result.insertId ?? -1);
});
active = true;
return -1;
}
InputDecoration inputDecoration(String text) {
return InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(50)
),
hintText: text
);
}
}
It often occurs when I click button too much but not necessarily. Seems like the problem is not inside database connection because even if I make onPressed method return null it keeps crashing randomly.
backtrace here:
F/libc ( 1471): Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 1471 (rd.plus.bilbord), pid 1471 (rd.plus.bilbord)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'samsung/j6lteser/j6lte:10/QP1A.190711.020/J600FPUUACUH2:user/release-keys'
Revision: '2'
ABI: 'arm'
Timestamp: 2022-04-05 19:46:37+0300
pid: 1471, tid: 1471, name: rd.plus.bilbord >>> com.bilbord.plus.bilbord <<<
uid: 10850
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
r0 00000000 r1 000005bf r2 00000006 r3 ffa0ca98
r4 ffa0caac r5 ffa0ca90 r6 000005bf r7 0000016b
r8 ffa0caa8 r9 ffa0ca98 r10 ffa0cac8 r11 ffa0cab8
ip 000005bf sp ffa0ca68 lr e8f6bc9f pc e8f6bcb2
backtrace:
#00 pc 0005fcb2 /apex/com.android.runtime/lib/bionic/libc.so (abort+166) (BuildId: 68663d64ac44a935374eee374ddf6c9d)
#01 pc 00e4c8dc /data/app/com.bilbord.plus.bilbord-0o-LBQ3J8mU0n-fQauoaWw==/base.apk!libmaps-mobile.so (offset 0x6540000)
#02 pc 00e4c2d8 /data/app/com.bilbord.plus.bilbord-0o-LBQ3J8mU0n-fQauoaWw==/base.apk!libmaps-mobile.so (offset 0x6540000)
#03 pc 00e4c11c /data/app/com.bilbord.plus.bilbord-0o-LBQ3J8mU0n-fQauoaWw==/base.apk!libmaps-mobile.so (offset 0x6540000)
#04 pc 01293980 /data/app/com.bilbord.plus.bilbord-0o-LBQ3J8mU0n-fQauoaWw==/base.apk!libmaps-mobile.so (offset 0x6540000)
#05 pc 01294430 /data/app/com.bilbord.plus.bilbord-0o-LBQ3J8mU0n-fQauoaWw==/base.apk!libmaps-mobile.so (offset 0x6540000)
#06 pc 01294a14 /data/app/com.bilbord.plus.bilbord-0o-LBQ3J8mU0n-fQauoaWw==/base.apk!libmaps-mobile.so (offset 0x6540000)
#07 pc 00efe7ac /data/app/com.bilbord.plus.bilbord-0o-LBQ3J8mU0n-fQauoaWw==/base.apk!libmaps-mobile.so (offset 0x6540000)
#08 pc 00eff39c /data/app/com.bilbord.plus.bilbord-0o-LBQ3J8mU0n-fQauoaWw==/base.apk!libmaps-mobile.so (offset 0x6540000)
#09 pc 00c06b8c /data/app/com.bilbord.plus.bilbord-0o-LBQ3J8mU0n-fQauoaWw==/base.apk!libmaps-mobile.so (offset 0x6540000)
#10 pc 00c06b24 /data/app/com.bilbord.plus.bilbord-0o-LBQ3J8mU0n-fQauoaWw==/base.apk!libmaps-mobile.so (offset 0x6540000)
#11 pc 00c060c0 /data/app/com.bilbord.plus.bilbord-0o-LBQ3J8mU0n-fQauoaWw==/base.apk!libmaps-mobile.so (offset 0x6540000)
#12 pc 00bf18a4 /data/app/com.bilbord.plus.bilbord-0o-LBQ3J8mU0n-fQauoaWw==/base.apk!libmaps-mobile.so (offset 0x6540000)
#13 pc 00c00214 /data/app/com.bilbord.plus.bilbord-0o-LBQ3J8mU0n-fQauoaWw==/base.apk!libmaps-mobile.so (offset 0x6540000) (Java_com_yandex_runtime_async_internal_Scheduler_run+28)
#14 pc 000dc519 /apex/com.android.runtime/lib/libart.so (art_quick_generic_jni_trampoline+40) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#15 pc 0201fcdd /memfd:/jit-cache (deleted) (com.yandex.runtime.async.internal.Scheduler.handleMessage+92)
#16 pc 0201fe07 /memfd:/jit-cache (deleted) (android.os.Handler.dispatchMessage+134)
#17 pc 02078a5b /memfd:/jit-cache (deleted) (android.os.Looper.loop+1114)
#18 pc 000d7c0f /apex/com.android.runtime/lib/libart.so (art_quick_osr_stub+46) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#19 pc 002587c5 /apex/com.android.runtime/lib/libart.so (art::jit::Jit::MaybeDoOnStackReplacement(art::Thread*, art::ArtMethod*, unsigned int, int, art::JValue*)+1160) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#20 pc 00432b57 /apex/com.android.runtime/lib/libart.so (MterpMaybeDoOnStackReplacement+134) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#21 pc 000d73f4 /apex/com.android.runtime/lib/libart.so (MterpHelpers+244) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#22 pc 0039b98c /system/framework/framework.jar (android.os.Looper.loop+1076)
#23 pc 0042c451 /apex/com.android.runtime/lib/libart.so (MterpInvokeStatic+932) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#24 pc 000d2994 /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_static+20) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#25 pc 001a7b8c /system/framework/framework.jar (android.app.ActivityThread.main+208)
#26 pc 001ecbfb /apex/com.android.runtime/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEbb.llvm.521985996776985852+194) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#27 pc 001f126d /apex/com.android.runtime/lib/libart.so (art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*)+120) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#28 pc 0041e56d /apex/com.android.runtime/lib/libart.so (artQuickToInterpreterBridge+832) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#29 pc 000dc5a1 /apex/com.android.runtime/lib/libart.so (art_quick_to_interpreter_bridge+32) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#30 pc 000d7bc5 /apex/com.android.runtime/lib/libart.so (art_quick_invoke_stub_internal+68) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#31 pc 00434b2b /apex/com.android.runtime/lib/libart.so (art_quick_invoke_static_stub+246) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#32 pc 000dffb7 /apex/com.android.runtime/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+186) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#33 pc 003751fb /apex/com.android.runtime/lib/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+54) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#34 pc 003764df /apex/com.android.runtime/lib/libart.so (art::InvokeMethod(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned int)+798) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#35 pc 0031ffcf /apex/com.android.runtime/lib/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*)+30) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#36 pc 000bc86f /system/framework/arm/boot.oat (art_jni_trampoline+110) (BuildId: 8b6cd5d1d735a5ecea2ce73e111ee29f4bf27cd6)
#37 pc 000d7bc5 /apex/com.android.runtime/lib/libart.so (art_quick_invoke_stub_internal+68) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#38 pc 00434a17 /apex/com.android.runtime/lib/libart.so (art_quick_invoke_stub+250) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#39 pc 000dffa3 /apex/com.android.runtime/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+166) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#40 pc 00210797 /apex/com.android.runtime/lib/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+274) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#41 pc 0020c90f /apex/com.android.runtime/lib/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+802) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#42 pc 00429bcd /apex/com.android.runtime/lib/libart.so (MterpInvokeVirtual+584) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#43 pc 000d2814 /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_virtual+20) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#44 pc 0048e21a /system/framework/framework.jar (com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run+22)
#45 pc 001ecbfb /apex/com.android.runtime/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEbb.llvm.521985996776985852+194) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#46 pc 001f126d /apex/com.android.runtime/lib/libart.so (art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*)+120) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#47 pc 0041e56d /apex/com.android.runtime/lib/libart.so (artQuickToInterpreterBridge+832) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#48 pc 000dc5a1 /apex/com.android.runtime/lib/libart.so (art_quick_to_interpreter_bridge+32) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#49 pc 0083e961 /system/framework/arm/boot-framework.oat (com.android.internal.os.ZygoteInit.main+2624) (BuildId: 4715203b9e45ebc9cb938eb2cc784d6fb0d09854)
#50 pc 000d7bc5 /apex/com.android.runtime/lib/libart.so (art_quick_invoke_stub_internal+68) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#51 pc 00434b2b /apex/com.android.runtime/lib/libart.so (art_quick_invoke_static_stub+246) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#52 pc 000dffb7 /apex/com.android.runtime/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+186) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#53 pc 003751fb /apex/com.android.runtime/lib/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+54) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#54 pc 0037502d /apex/com.android.runtime/lib/libart.so (art::InvokeWithVarArgs(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+288) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#55 pc 002bcf27 /apex/com.android.runtime/lib/libart.so (art::JNI::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+450) (BuildId: ed364b51d6bb80891e65519216d6b1c8)
#56 pc 000a3355 /system/lib/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+28) (BuildId: 13bebefab0b9ce92186765028bf880b6)
#57 pc 000a5923 /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+506) (BuildId: 13bebefab0b9ce92186765028bf880b6)
#58 pc 000022f5 /system/bin/app_process32 (main+688) (BuildId: d4953d8a8590b8a7c5546cc79cd4f267)
#59 pc 0005a117 /apex/com.android.runtime/lib/bionic/libc.so (__libc_init+66) (BuildId: 68663d64ac44a935374eee374ddf6c9d)
#60 pc 0000202f /system/bin/app_process32 (_start_main+38) (BuildId: d4953d8a8590b8a7c5546cc79cd4f267)
#61 pc 00004456 <anonymous:ea5aa000>
Lost connection to device.
The problem was solved by replacing sliding_up_panel
lib with native DraggableScrollableSheet