Skip to content

Instantly share code, notes, and snippets.

Avatar
🎖️
Finishing the ToDo List, one task at a time.

Shivam Goyal ShivamGoyal1899

🎖️
Finishing the ToDo List, one task at a time.
View GitHub Profile
View customDateTimePicker.dart
class CustomPicker extends CommonPickerModel {
String digits(int value, int length) {
return '$value'.padLeft(length, "0");
}
CustomPicker({DateTime currentTime, LocaleType locale}) : super(locale: locale) {
this.currentTime = currentTime ?? DateTime.now();
this.setLeftIndex(this.currentTime.hour);
this.setMiddleIndex(this.currentTime.minute);
this.setRightIndex(this.currentTime.second);
}
View const.dart
const AlertDialog({
Key key,
Widget title,
EdgeInsetsGeometry titlePadding,
TextStyle titleTextStyle,
Widget content,
EdgeInsetsGeometry contentPadding: const EdgeInsets.fromLTRB(24.0, 20.0, 24.0, 24.0),
TextStyle contentTextStyle,
List<Widget> actions,
Color backgroundColor,
View pubspec.yaml
...
flutter:
uses-material-design: true
assets:
- assets/images/listening.gif
...
View voicePayDialogDemo.dart
onPressed: () {
showDialog(
context: context,
builder: (BuildContext context) {
return VoicePay();
},
);
},
View voicePayDialog.dart
import 'package:flutter/material.dart';
class VoicePay extends StatefulWidget {
@override
_VoicePayState createState() => _VoicePayState();
}
class _VoicePayState extends State<VoicePay> {
@override
View shopping_cart_tab.dart
switch (index) {
case 0:
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: _buildNameField(),
);
case 1:
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: _buildEmailField(),
View shopping_cart_tab.dart
SliverChildBuilderDelegate _buildSliverChildBuilderDelegate(
AppStateModel model) {
return SliverChildBuilderDelegate(
(context, index) {
switch (index) {
case 0:
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: _buildNameField(),
);
View shopping_cart_tab.dart
class _ShoppingCartTabState extends State<ShoppingCartTab> {
// ...
Widget _buildDateAndTimePicker(BuildContext context) { // NEW FROM HERE
return Column(
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Row(
View shopping_cart_tab.dart
import 'package:flutter/cupertino.dart';
import 'package:intl/intl.dart'; // NEW
import 'package:scoped_model/scoped_model.dart';
import 'model/app_state_model.dart';
import 'styles.dart'; // NEW
const double _kDateTimePickerHeight = 216; // NEW
View shopping_cart_tab.dart
@override
Widget build(BuildContext context) {
return Consumer<AppStateModel>(
builder: (context, model, child) {
return CustomScrollView(
slivers: <Widget>[
const CupertinoSliverNavigationBar(
largeTitle: Text('Shopping Cart'),
),
SliverSafeArea(