@@ -7,6 +7,7 @@ import 'package:flutter/material.dart';
7
7
import 'package:flutter_bloc/flutter_bloc.dart' ;
8
8
import 'package:google_maps_flutter/google_maps_flutter.dart' ;
9
9
import 'package:flutter_svg/svg.dart' ;
10
+ import 'package:pointer_interceptor/pointer_interceptor.dart' ;
10
11
import 'package:tradule/common/app_bar_blur.dart' ;
11
12
import 'package:tradule/common/color.dart' ;
12
13
import 'package:tradule/common/my_text_field.dart' ;
@@ -86,8 +87,10 @@ class _MyPlaceScreenState extends State<MyPlaceScreen>
86
87
spacing: 20 ,
87
88
children: < Widget > [
88
89
MyTextField (
90
+ key: Key ('search' ),
89
91
controller: _searchController,
90
92
hintText: '장소 이름, 태그로 검색' ,
93
+ autoFocus: false ,
91
94
onSubmitted: (_) {
92
95
// _searchPlace(_searchController.text);
93
96
setState (() {});
@@ -96,6 +99,9 @@ class _MyPlaceScreenState extends State<MyPlaceScreen>
96
99
// _searchPlace(value);
97
100
setState (() {});
98
101
},
102
+ onTapOutside: (_) {
103
+ FocusManager .instance.primaryFocus? .unfocus ();
104
+ },
99
105
),
100
106
Padding (
101
107
padding: const EdgeInsets .only (top: 4 ),
@@ -353,6 +359,7 @@ class _AddMyPlaceDialogState extends State<AddMyPlaceDialog> {
353
359
].toList ();
354
360
BitmapDescriptor _markerIcon = BitmapDescriptor .defaultMarker;
355
361
LatLng _markerPosition = const LatLng (37.5662952 , 126.9779451 );
362
+ bool scrollAble = true ;
356
363
357
364
@override
358
365
void initState () {
@@ -377,7 +384,8 @@ class _AddMyPlaceDialogState extends State<AddMyPlaceDialog> {
377
384
final padding = MediaQuery .of (context).padding;
378
385
return GestureDetector (
379
386
onTap: () {
380
- FocusScope .of (context).unfocus ();
387
+ // FocusScope.of(context).unfocus();
388
+ FocusManager .instance.primaryFocus? .unfocus ();
381
389
},
382
390
child: Stack (
383
391
children: [
@@ -390,26 +398,35 @@ class _AddMyPlaceDialogState extends State<AddMyPlaceDialog> {
390
398
elevation: 0 ,
391
399
color: Colors .transparent,
392
400
child: Container (
393
- padding: const EdgeInsets .all (16 ),
401
+ // padding: const EdgeInsets.all(16),
394
402
decoration: BoxDecoration (
395
403
color: Colors .white,
396
404
borderRadius: BorderRadius .circular (16 ),
397
405
),
398
406
child: Column (
399
407
spacing: 8 ,
400
408
children: < Widget > [
401
- Text (
402
- '나만의 장소 추가' ,
403
- style: myTextStyle (
404
- color: cPrimaryDark,
405
- fontSize: 20 ,
406
- fontWeight: FontWeight .bold,
409
+ Padding (
410
+ padding:
411
+ const EdgeInsets .only (top: 16 , left: 16 , right: 16 ),
412
+ child: Text (
413
+ '나만의 장소 추가' ,
414
+ style: myTextStyle (
415
+ color: cPrimaryDark,
416
+ fontSize: 20 ,
417
+ fontWeight: FontWeight .bold,
418
+ ),
407
419
),
408
420
),
409
421
Expanded (
410
422
child: SingleChildScrollFadeView (
423
+ physics: scrollAble
424
+ ? const AlwaysScrollableScrollPhysics ()
425
+ : const NeverScrollableScrollPhysics (),
426
+ scrollController: ScrollController (),
411
427
child: Padding (
412
- padding: const EdgeInsets .all (8.0 ),
428
+ padding: const EdgeInsets .all (8.0 ) +
429
+ const EdgeInsets .symmetric (horizontal: 16 ),
413
430
child: Column (
414
431
spacing: 16 ,
415
432
children: < Widget > [
@@ -464,60 +481,74 @@ class _AddMyPlaceDialogState extends State<AddMyPlaceDialog> {
464
481
//구글 지도
465
482
Padding (
466
483
padding: const EdgeInsets .all (8.0 ),
467
- child: Column (
468
- children: [
469
- Stack (
470
- children: [
471
- Container (
472
- height: 300 ,
473
- child: GoogleMap (
474
- gestureRecognizers: {
475
- Factory <OneSequenceGestureRecognizer >(
476
- () =>
477
- EagerGestureRecognizer ())
478
- },
479
- initialCameraPosition:
480
- const CameraPosition (
481
- target: LatLng (
482
- 37.5662952 , 126.9779451 ),
483
- zoom: 12 ,
484
- ),
485
- markers: {
486
- Marker (
487
- markerId: const MarkerId ('1' ),
488
- position: const LatLng (
484
+ child: MouseRegion (
485
+ onEnter: (_) {
486
+ setState (() {
487
+ scrollAble = false ;
488
+ });
489
+ },
490
+ onExit: (_) {
491
+ setState (() {
492
+ scrollAble = true ;
493
+ });
494
+ },
495
+ child: Column (
496
+ children: [
497
+ Stack (
498
+ children: [
499
+ Container (
500
+ height: 300 ,
501
+ child: GoogleMap (
502
+ webGestureHandling:
503
+ WebGestureHandling .greedy,
504
+ gestureRecognizers: const {
505
+ Factory <OneSequenceGestureRecognizer >(
506
+ EagerGestureRecognizer .new ),
507
+ },
508
+ initialCameraPosition:
509
+ const CameraPosition (
510
+ target: LatLng (
489
511
37.5662952 , 126.9779451 ),
490
- icon: _markerIcon,
491
- draggable: true ,
492
- onDrag: (LatLng latLng) {
493
- _markerPosition = latLng;
494
- setState (() {});
495
- },
512
+ zoom: 12 ,
496
513
),
497
- },
514
+ markers: {
515
+ Marker (
516
+ markerId: const MarkerId ('1' ),
517
+ position: const LatLng (
518
+ 37.5662952 , 126.9779451 ),
519
+ icon: _markerIcon,
520
+ draggable: true ,
521
+ onDrag: (LatLng latLng) {
522
+ _markerPosition = latLng;
523
+ setState (() {});
524
+ },
525
+ ),
526
+ },
527
+ ),
498
528
),
499
- ),
500
- //장소 검색
501
- Positioned (
502
- top: 10 ,
503
- left: 10 ,
504
- right: 10 ,
505
- child: MyTextField (
506
- controller: TextEditingController (),
507
- hintText: '장소 검색' ,
529
+ //장소 검색
530
+ Positioned (
531
+ top: 10 ,
532
+ left: 10 ,
533
+ right: 10 ,
534
+ child: MyTextField (
535
+ controller:
536
+ TextEditingController (),
537
+ hintText: '장소 검색' ,
538
+ ),
508
539
),
540
+ ],
541
+ ),
542
+ Text (
543
+ '핀을 드래그하여 이동할 수 있어요!' ,
544
+ style: myTextStyle (
545
+ color: cPrimary,
546
+ fontSize: 14 ,
509
547
),
510
- ],
511
- ),
512
- Text (
513
- '핀을 드래그하여 이동할 수 있어요!' ,
514
- style: myTextStyle (
515
- color: cPrimary,
516
- fontSize: 14 ,
548
+ textAlign: TextAlign .center,
517
549
),
518
- textAlign: TextAlign .center,
519
- ),
520
- ],
550
+ ],
551
+ ),
521
552
),
522
553
),
523
554
@@ -565,36 +596,40 @@ class _AddMyPlaceDialogState extends State<AddMyPlaceDialog> {
565
596
),
566
597
),
567
598
),
568
- Row (
569
- mainAxisAlignment: MainAxisAlignment .end,
570
- children: < Widget > [
571
- ElevatedButton (
572
- onPressed: () {
573
- Navigator .pop (context);
574
- },
575
- child: const Text ('취소' ),
576
- ),
577
- const SizedBox (width: 8 ),
578
- ElevatedButton (
579
- onPressed: () {
580
- final placeData = PlaceData (
581
- id: Random ().nextInt (1000000 ),
582
- title: _titleController.text,
583
- description: _descriptionController.text,
584
- latitude: _markerPosition.latitude,
585
- longitude: _markerPosition.longitude,
586
- address: '주소 없음' ,
587
- tags: _tags,
588
- isProvided: false ,
589
- createdTime: DateTime .now (),
590
- );
591
- ServerWrapper .userCubit.addPlace (placeData);
592
- ServerWrapper .putMyPlaceList ();
593
- Navigator .pop (context);
594
- },
595
- child: const Text ('추가' ),
596
- ),
597
- ],
599
+ Padding (
600
+ padding: const EdgeInsets .only (
601
+ bottom: 16 , left: 16 , right: 16 ),
602
+ child: Row (
603
+ mainAxisAlignment: MainAxisAlignment .end,
604
+ children: < Widget > [
605
+ ElevatedButton (
606
+ onPressed: () {
607
+ Navigator .pop (context);
608
+ },
609
+ child: const Text ('취소' ),
610
+ ),
611
+ const SizedBox (width: 8 ),
612
+ ElevatedButton (
613
+ onPressed: () {
614
+ final placeData = PlaceData (
615
+ id: Random ().nextInt (1000000 ),
616
+ title: _titleController.text,
617
+ description: _descriptionController.text,
618
+ latitude: _markerPosition.latitude,
619
+ longitude: _markerPosition.longitude,
620
+ address: '주소 없음' ,
621
+ tags: _tags,
622
+ isProvided: false ,
623
+ createdTime: DateTime .now (),
624
+ );
625
+ ServerWrapper .userCubit.addPlace (placeData);
626
+ ServerWrapper .putMyPlaceList ();
627
+ Navigator .pop (context);
628
+ },
629
+ child: const Text ('추가' ),
630
+ ),
631
+ ],
632
+ ),
598
633
),
599
634
],
600
635
),
0 commit comments