Merge pull request #99 from Abdullah-Zakhoi/master
added bottom sheet dialog rather than SimpleDialog
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:country_code_picker/country_code.dart';
|
|||||||
import 'package:country_code_picker/country_codes.dart';
|
import 'package:country_code_picker/country_codes.dart';
|
||||||
import 'package:country_code_picker/selection_dialog.dart';
|
import 'package:country_code_picker/selection_dialog.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
|
||||||
|
|
||||||
export 'country_code.dart';
|
export 'country_code.dart';
|
||||||
|
|
||||||
@@ -226,9 +227,11 @@ class CountryCodePickerState extends State<CountryCodePicker> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void showCountryCodePickerDialog() {
|
void showCountryCodePickerDialog() {
|
||||||
showDialog(
|
showMaterialModalBottomSheet(
|
||||||
|
barrierColor: Colors.grey.withOpacity(0.5),
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (_) => SelectionDialog(
|
builder: (context, scrollController) => SelectionDialog(
|
||||||
elements,
|
elements,
|
||||||
favoriteElements,
|
favoriteElements,
|
||||||
showCountryOnly: widget.showCountryOnly,
|
showCountryOnly: widget.showCountryOnly,
|
||||||
|
|||||||
@@ -44,9 +44,28 @@ class _SelectionDialogState extends State<SelectionDialog> {
|
|||||||
List<CountryCode> filteredElements;
|
List<CountryCode> filteredElements;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => SimpleDialog(
|
Widget build(BuildContext context) => Padding(
|
||||||
titlePadding: const EdgeInsets.all(0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
title: Column(
|
child: Container(
|
||||||
|
width: widget.size?.width ?? MediaQuery.of(context).size.width,
|
||||||
|
height:
|
||||||
|
widget.size?.height ?? MediaQuery.of(context).size.height * 0.85,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(25.0)),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.grey.withOpacity(1),
|
||||||
|
spreadRadius: 5,
|
||||||
|
blurRadius: 7,
|
||||||
|
offset: Offset(0, 3), // changes position of shadow
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@@ -69,11 +88,10 @@ class _SelectionDialogState extends State<SelectionDialog> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
children: [
|
|
||||||
Container(
|
Container(
|
||||||
width: widget.size?.width ?? MediaQuery.of(context).size.width,
|
width: widget.size?.width ?? MediaQuery.of(context).size.width,
|
||||||
height:
|
height: widget.size?.height ??
|
||||||
widget.size?.height ?? MediaQuery.of(context).size.height * 0.7,
|
MediaQuery.of(context).size.height * 0.7,
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
widget.favoriteElements.isEmpty
|
widget.favoriteElements.isEmpty
|
||||||
@@ -108,6 +126,8 @@ class _SelectionDialogState extends State<SelectionDialog> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildOption(CountryCode e) {
|
Widget _buildOption(CountryCode e) {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ environment:
|
|||||||
sdk: ">=2.2.2 <3.0.0"
|
sdk: ">=2.2.2 <3.0.0"
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
|
modal_bottom_sheet: ^0.2.0+1
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user