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/selection_dialog.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
|
||||
|
||||
export 'country_code.dart';
|
||||
|
||||
@@ -226,9 +227,11 @@ class CountryCodePickerState extends State<CountryCodePicker> {
|
||||
}
|
||||
|
||||
void showCountryCodePickerDialog() {
|
||||
showDialog(
|
||||
showMaterialModalBottomSheet(
|
||||
barrierColor: Colors.grey.withOpacity(0.5),
|
||||
backgroundColor: Colors.transparent,
|
||||
context: context,
|
||||
builder: (_) => SelectionDialog(
|
||||
builder: (context, scrollController) => SelectionDialog(
|
||||
elements,
|
||||
favoriteElements,
|
||||
showCountryOnly: widget.showCountryOnly,
|
||||
|
||||
@@ -44,9 +44,28 @@ class _SelectionDialogState extends State<SelectionDialog> {
|
||||
List<CountryCode> filteredElements;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => SimpleDialog(
|
||||
titlePadding: const EdgeInsets.all(0),
|
||||
title: Column(
|
||||
Widget build(BuildContext context) => Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
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,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
@@ -69,11 +88,10 @@ class _SelectionDialogState extends State<SelectionDialog> {
|
||||
),
|
||||
],
|
||||
),
|
||||
children: [
|
||||
Container(
|
||||
width: widget.size?.width ?? MediaQuery.of(context).size.width,
|
||||
height:
|
||||
widget.size?.height ?? MediaQuery.of(context).size.height * 0.7,
|
||||
height: widget.size?.height ??
|
||||
MediaQuery.of(context).size.height * 0.7,
|
||||
child: ListView(
|
||||
children: [
|
||||
widget.favoriteElements.isEmpty
|
||||
@@ -108,6 +126,8 @@ class _SelectionDialogState extends State<SelectionDialog> {
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Widget _buildOption(CountryCode e) {
|
||||
|
||||
@@ -7,6 +7,7 @@ environment:
|
||||
sdk: ">=2.2.2 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
modal_bottom_sheet: ^0.2.0+1
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
|
||||
Reference in New Issue
Block a user