repo_id
stringlengths 21
168
| file_path
stringlengths 36
210
| content
stringlengths 1
9.98M
| __index_level_0__
int64 0
0
|
---|---|---|---|
mirrored_repositories/judou/lib/discovery | mirrored_repositories/judou/lib/discovery/BLoc/recommand_bloc.dart | import 'dart:async';
import '../../network/network.dart';
import '../models/post_model.dart';
import '../models/video_model.dart';
import '../models/subject_model.dart';
import '../models/carousel_model.dart';
import '../../index/models/judou_model.dart';
class RecommandBloc implements BlocBase {
final _fetchSubject = PublishSubject<Map<String, dynamic>>();
RecommandBloc() {
_fetchData();
}
Stream<Map<String, dynamic>> get stream => _fetchSubject.stream;
void _fetchData() async {
// 推荐
Map<String, dynamic> recommands = await Request.instance.dio
.get(RequestPath.recommand())
.then((response) => response.data)
.then((response) {
List l1 = response['posts'] as List;
List l2 = response['subjects'] as List;
List l3 = response['videos'] as List;
List<PostModel> posts =
l1.map((item) => PostModel.fromJSON(item)).toList();
List<SubjectModel> subjects =
l2.map((item) => SubjectModel.fromJSON(item)).toList();
List<VideoModel> videos =
l3.map((item) => VideoModel.fromJSON(item)).toList();
return {'posts': posts, 'subjects': subjects, 'videos': videos};
});
// 轮播
List<CarouselModel> carousels = await Request.instance.dio
.get(RequestPath.carousels())
.then((response) => response.data)
.then((response) => response['data'] as List)
.then((response) =>
response.map((item) => CarouselModel.fromJSON(item)).toList());
// 今日哲思
List<JuDouModel> today = await Request.instance.dio
.get(RequestPath.todayThink())
.then((response) => response.data)
.then((response) => response['data'] as List)
.then((response) =>
response.map((item) => JuDouModel.fromJson(item)).toList());
/// 最后的所有数据组装完毕
/// posts -> List<PostModel>
/// subjects -> List<SubjectModel>
/// videos -> List<VideoModel>
/// carousels -> List<CarouselModel>
recommands.addAll({'carousels': carousels, 'today': today});
if (!_fetchSubject.isClosed) {
_fetchSubject.sink.add(recommands);
}
}
@override
dispose() {
if (!_fetchSubject.isClosed) {
_fetchSubject.close();
}
}
}
| 0 |
mirrored_repositories/judou/lib/discovery | mirrored_repositories/judou/lib/discovery/BLoc/discovery_bloc.dart | import '../models/topic_model.dart';
import '../../network/network.dart';
import '../../index/models/tag_model.dart';
import '../../index/models/judou_model.dart';
import 'dart:async';
class DiscoveryBloc implements BlocBase {
final _discoverySubject = PublishSubject<Map<String, dynamic>>();
List<TopicModel> _topics;
List<TagModel> tags;
List<JuDouModel> _tagListData;
DiscoveryBloc() {
_fetchData();
}
/// 获取tab标题相关数据
/// 整个方法已经在最新的版本中废弃
// void _fetchTitle() async {
// List<TabModel> tabs = await Request.instance.dio
// .get(RequestPath.channels())
// .then((response) => response.data['data'] as List)
// .then((response) =>
// response.map((item) => TabModel.fromJSON(item)).toList());
// tabSubject.sink.add(tabs);
// }
Stream<Map<String, dynamic>> get stream => _discoverySubject.stream;
/// 拉取当前页面的数据, 并进行组装, 最终返回的是一个Map<String, dynamic>
/// topics -> 话题数据
/// tags -> 中间tag标题
/// tagListData -> 某一个tag的数据
void _fetchData() async {
_topics = await Request.instance.dio
.get(RequestPath.topicData())
.then((response) => response.data['data'] as List)
.then((response) =>
response.map((item) => TopicModel.fromJSON(item)).toList());
tags = await Request.instance.dio
.get(RequestPath.discoveryTags())
.then((response) => response.data['data'] as List)
.then((response) =>
response.map((item) => TagModel.fromJSON(item)).toList());
fetchTagListDataWithId('${tags[0].id}');
}
/// 根据[id]获取某个tag下的数据
/// [id] -> tagId
void fetchTagListDataWithId(String id) async {
_tagListData = await Request.instance.dio
.get(RequestPath.dataWithTagId(id))
.then((response) => response.data['data'] as List)
.then((response) => response.where((item) => !item['is_ad']).toList())
.then((response) =>
response.map((item) => JuDouModel.fromJson(item)).toList());
Map<String, dynamic> map = {
'topics': _topics,
'tags': tags,
'tagListData': _tagListData
};
if (!_discoverySubject.isClosed) {
_discoverySubject.sink.add(map);
}
}
@override
dispose() {
if (!_discoverySubject.isClosed) _discoverySubject.close();
}
}
| 0 |
mirrored_repositories/judou/lib | mirrored_repositories/judou/lib/utils/date_util.dart | import 'package:intl/intl.dart';
class DateUtils {
static String fromNow(int timeStamp) {
/// 因为dart里面并没有实现时区的设置,只能手动设置了
int now = DateTime.now().millisecondsSinceEpoch + 8 * 3600000;
double distance = (now - timeStamp) / 60000;
// 大于24小时就直接显示日期
if (distance > 24 * 60) {
DateTime time =
DateTime.fromMillisecondsSinceEpoch((timeStamp + 8 * 3600) * 1000);
return DateFormat('yyyy/MM/dd HH:mm').format(time);
}
if (distance > 60 && distance < 24 * 60) {
return '${(distance / 60).toStringAsFixed(0)}小时前';
}
if (distance < 60 && distance > 1) {
return '${distance.toStringAsFixed(0)}分钟前';
} else {
DateTime time =
DateTime.fromMillisecondsSinceEpoch((timeStamp + 8 * 3600) * 1000);
return DateFormat('yyyy/MM/dd HH:mm').format(time);
}
}
static String replaceLineWithDot(String date) {
return date.replaceAll(RegExp(r'-'), '.');
}
}
| 0 |
mirrored_repositories/judou/lib | mirrored_repositories/judou/lib/utils/color_util.dart | import 'package:flutter/material.dart';
class ColorUtils {
/// icon颜色
static const Color iconColor = Colors.black54;
/// 分割线颜色
static const Color dividerColor = Color(0xFFEEEEEE);
/// 空白分割条颜色
static const Color blankColor = Color(0xFFFAFAFA);
/// 文字主色
static const Color textPrimaryColor = Color(0xFF333333);
/// 灰色文字颜色
static const Color textGreyColor = Color(0x42000000);
/// 用户信息的用户名颜色
static const Color textUserNameColor = Color(0x73000000);
}
| 0 |
mirrored_repositories/judou/lib | mirrored_repositories/judou/lib/utils/ui_util.dart | import 'package:flutter/material.dart';
import 'color_util.dart';
class AppBarUtils {
static AppBar appBar(String title, BuildContext context,
[Widget leading, List<Widget> actions]) {
void backAction() {
Navigator.pop(context);
}
return AppBar(
title: Text(
title,
style: TextStyle(
color: Color.fromARGB(255, 45, 45, 45),
fontWeight: FontWeight.w300,
fontSize: 18,
fontFamily: 'PingFang'),
),
centerTitle: true,
leading: leading ??
IconButton(
icon: Icon(Icons.arrow_back_ios,
color: ColorUtils.iconColor, size: 20),
onPressed: backAction,
),
actions: actions,
);
}
}
class DeviceUtils {
static bool iPhoneXAbove(BuildContext context) {
return (DeviceUtils.sreenWidth(context) >= 375 &&
DeviceUtils.sreenHeight(context) >= 812);
}
static double sreenWidth(BuildContext context) {
return (MediaQuery.of(context).size.width);
}
static double sreenHeight(BuildContext context) {
return (MediaQuery.of(context).size.height);
}
}
| 0 |
mirrored_repositories/judou/lib/index | mirrored_repositories/judou/lib/index/widgets/index_item.dart | import 'package:flutter/material.dart';
import '../models/judou_model.dart';
import '../widgets/vertical_text.dart';
class IndexPageItem extends StatefulWidget {
IndexPageItem({Key key, this.onTap, this.model}) : super(key: key);
final VoidCallback onTap;
final JuDouModel model;
@override
_IndexPageItemState createState() => _IndexPageItemState();
}
class _IndexPageItemState extends State<IndexPageItem>
with AutomaticKeepAliveClientMixin {
String day = '';
String dailyDate = '';
@override
bool get wantKeepAlive => true;
@override
initState() {
super.initState();
// 日期转换
String dayString = widget.model.dailyDate.toString();
String weekday = '';
String dailyString = '';
if (dayString != '' || dailyString != 'null') {
dailyString = dayString.substring(0, 7).replaceAll(RegExp(r'-'), '.');
var date = DateTime.parse(widget.model.dailyDate);
List<String> dayList = ['一', '二', '三', '四', '五', '六', '日'];
weekday = dayList[date.weekday - 1];
day = '$date'.substring(8, 10);
dailyDate = dailyString + '星期' + '$weekday';
}
}
// 字体设置
TextStyle textStyle(double fontSize, bool isSpace) => TextStyle(
fontSize: fontSize,
fontFamily: 'PingFang',
fontWeight: FontWeight.w200,
letterSpacing: isSpace ? 1 : 0,
);
Widget verticalText(String text, double rightPosition) => Positioned(
child: Container(
padding: EdgeInsets.only(left: 2),
decoration: BoxDecoration(
border: Border(left: BorderSide(color: Colors.white, width: 0.5)),
),
child: VerticalText(
text: text,
color: Colors.white,
size: 10,
),
),
top: 10,
right: rightPosition + 10,
);
// 顶部大图部分
Stack headerView() => Stack(
children: <Widget>[
SizedBox(
child: Image.network(widget.model.pictures[0].url,
fit: BoxFit.cover,
width: MediaQuery.of(context).size.width,
height: 260,
gaplessPlayback: true),
),
Positioned(
child:
Text(day, style: TextStyle(fontSize: 99, color: Colors.white)),
bottom: -50,
left: 20,
),
verticalText('戊戌狗年', 15),
verticalText('甲子月庚寅日', 35),
verticalText('腊月甘十八', 55),
],
);
// 文章和作者部分
Container contentView() => Container(
padding: EdgeInsets.all(20),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(widget.model.content,
style: textStyle(17, true), textAlign: TextAlign.start),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Container(
padding: EdgeInsets.only(top: 10),
child: Text(widget.model.subHeading,
style: textStyle(17, true), textAlign: TextAlign.end),
)
],
)
],
),
);
@override
Widget build(BuildContext context) {
super.build(context);
return GestureDetector(
onTap: widget.onTap,
child: Column(
children: <Widget>[
headerView(),
Expanded(
child: Stack(
children: <Widget>[
SizedBox(child: contentView()),
Positioned(
child: Text(day,
style: TextStyle(fontSize: 99, color: Colors.black)),
top: -70,
left: 20),
Positioned(
child: Text(dailyDate,
style: textStyle(12, false), textAlign: TextAlign.end),
right: 20,
top: 5)
],
),
),
],
),
);
}
}
| 0 |
mirrored_repositories/judou/lib/index | mirrored_repositories/judou/lib/index/widgets/vertical_text.dart | import 'package:flutter/material.dart';
class VerticalText extends StatelessWidget {
VerticalText({Key key, this.text, this.color, this.size}) : super(key: key);
final double size;
final String text;
final Color color;
@override
Widget build(BuildContext context) {
return Container(
width: size,
child: Text(
text,
style: TextStyle(
fontSize: size,
color: color,
height: 0.85,
fontWeight: FontWeight.w300,
),
),
);
}
}
| 0 |
mirrored_repositories/judou/lib/index | mirrored_repositories/judou/lib/index/widgets/detail_label.dart | import 'package:flutter/material.dart';
import '../../widgets/blank.dart';
import '../../widgets/label.dart';
class DetailLabel extends StatelessWidget {
DetailLabel({Key key, this.labelTitle}) : super(key: key);
final String labelTitle;
@override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
child: Column(
children: <Widget>[
Row(children: <Widget>[
Container(
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 15),
child: Label(
width: 40,
height: 20,
radius: 10,
title: labelTitle,
onTap: () => print('爱情'),
),
)
]),
Blank()
],
),
);
}
}
| 0 |
mirrored_repositories/judou/lib/index | mirrored_repositories/judou/lib/index/pages/detail_page.dart | import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import '../../utils/ui_util.dart';
import '../../widgets/blank.dart';
import '../../utils/color_util.dart';
import '../../widgets/judou_cell.dart';
import '../../widgets/comment_cell.dart';
import '../../widgets/end_cell.dart';
import '../widgets/detail_label.dart';
import '../models/judou_model.dart';
import '../models/comment_model.dart';
import '../../bloc_provider.dart';
import '../BLoc/detail_bloc.dart';
import '../../widgets/loading.dart';
class DetailPage extends StatelessWidget {
DetailPage({Key key, this.model}) : super(key: key);
final JuDouModel model;
@override
Widget build(BuildContext context) {
return BlocProvider(
bloc: DetailBloc(uuid: model.uuid),
child: DetailWidget(uuid: model.uuid),
);
}
}
class DetailWidget extends StatefulWidget {
DetailWidget({Key key, this.uuid});
final String uuid;
@override
State<StatefulWidget> createState() {
return _DetailWidgetStateful();
}
}
class _DetailWidgetStateful extends State<DetailWidget> {
DetailBloc detailBloc;
@override
void initState() {
super.initState();
detailBloc = BlocProvider.of<DetailBloc>(context);
}
@override
dispose() {
detailBloc.dispose();
super.dispose();
}
Widget sectionHeader(String title) {
return Container(
color: Colors.white,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.only(left: 15, top: 10),
child: Text(title),
),
Divider(),
],
),
);
}
Widget hotCommnets(List<CommentModel> hotList) {
List<CommentCell> listCell = List<CommentCell>();
for (var i = 0; i < hotList.length; i++) {
listCell.add(
CommentCell(
divider: i == hotList.length - 1 ? Container() : Divider(),
model: hotList[i]),
);
}
return Container(
color: Colors.white,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
sectionHeader('热门评论'),
Column(
children: listCell,
),
Blank(),
],
),
);
}
Widget body(
BuildContext context, AsyncSnapshot<Map<String, dynamic>> snapshot) {
if (snapshot.connectionState != ConnectionState.active) {
return Center(
child: Loading(),
);
}
List<CommentModel> hot = snapshot.data['hot'];
List<CommentModel> latest = snapshot.data['latest'];
JuDouModel model = snapshot.data['detail'];
int itemCount = latest.length + 5;
String endString = latest.isNotEmpty ? '- END -' : '快来添加第一条评论吧';
return Column(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height - 100,
child: ListView.builder(
itemBuilder: (context, index) {
if (index == 0)
return JuDouCell(
divider: Blank(),
tag: 'index_detail',
model: model,
isCell: false,
);
if (index == 1)
return model.tags != null
? DetailLabel(labelTitle: model.tags[0].name ?? '爱情')
: Container();
if (index == 2)
return hot.isNotEmpty ? hotCommnets(hot) : Container();
if (index == 3)
return latest.isNotEmpty ? sectionHeader('最新评论') : Container();
if (index == itemCount - 1) return EndCell(text: endString);
return CommentCell(
divider: index == itemCount - 2 ? Container() : Divider(),
model: latest[index - 4]);
},
itemCount: itemCount,
),
)
],
);
}
@override
Widget build(BuildContext context) {
return StreamBuilder(
stream: detailBloc.commentSteam,
builder: (context, AsyncSnapshot<Map<String, dynamic>> snapshot) {
return Scaffold(
appBar: AppBarUtils.appBar('详情', context),
backgroundColor: ColorUtils.blankColor,
body: body(context, snapshot),
floatingActionButton: _BottomInput(),
floatingActionButtonLocation:
FloatingActionButtonLocation.centerDocked,
resizeToAvoidBottomPadding: true,
);
},
);
}
}
class _BottomInput extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SafeArea(
right: false,
child: Container(
height: 50,
color: Colors.white,
child: Column(
children: <Widget>[
Blank(height: 0.5, color: Colors.black12),
Padding(
padding: EdgeInsets.only(top: 5, left: 15, right: 15),
child: CupertinoTextField(
placeholder: '说点什么...',
textAlign: TextAlign.center,
decoration: BoxDecoration(
color: ColorUtils.dividerColor,
border: Border.all(color: Colors.transparent),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(20.0),
),
style: TextStyle(
height: 1, fontSize: 12, color: ColorUtils.textGreyColor),
),
)
],
),
),
);
}
}
| 0 |
mirrored_repositories/judou/lib/index | mirrored_repositories/judou/lib/index/pages/index_page.dart | import 'package:flutter/material.dart';
import '../../utils/color_util.dart';
import '../widgets/index_item.dart';
import '../../widgets/button_subscript.dart';
import '../models/judou_model.dart';
import '../BLoc/index_bloc.dart';
import '../../bloc_provider.dart';
import 'package:flutter/services.dart';
class IndexPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocProvider(
bloc: IndexBloc(),
child: IndexWidget(),
);
}
}
class IndexWidget extends StatefulWidget {
@override
_IndexWidgetState createState() => _IndexWidgetState();
}
class _IndexWidgetState extends State<IndexWidget>
with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin {
PageController _pageController = PageController();
IndexBloc indexBloc;
String _like = '';
String _comment = '';
String _isLike = '';
@override
void initState() {
super.initState();
indexBloc = BlocProvider.of<IndexBloc>(context);
indexBloc.badgesSteam.listen((List<String> data) {
setState(() {
_like = data[1];
_comment = data[0];
_isLike = data[2];
});
});
}
// void _test() {
// print('-------1-');
// var platform = MethodChannel('judou.test');
// platform.invokeMethod('getString').then((result) {
// print('------- $result');
// });
// }
@override
void dispose() {
_pageController.dispose();
indexBloc.dispose();
super.dispose();
}
@override
bool get wantKeepAlive => true;
Icon likeIcon() => _isLike == '0'
? Icon(
Icons.favorite_border,
color: ColorUtils.iconColor,
)
: Icon(
Icons.favorite,
color: Colors.redAccent,
);
Widget indexAppBar() => AppBar(
iconTheme: IconThemeData(color: ColorUtils.iconColor),
centerTitle: true,
leading: Container(
alignment: Alignment.center,
child: Text(
'句子',
style: TextStyle(fontSize: 22.0, fontFamily: 'LiSung'),
),
),
actions: <Widget>[
SubscriptButton(
icon: Icon(Icons.message),
subscript: _comment,
onPressed: () => indexBloc.toDetailPage(context),
),
SubscriptButton(
icon: likeIcon(),
subscript: _like,
),
IconButton(
icon: Icon(Icons.share, color: ColorUtils.iconColor),
onPressed: () => indexBloc.toDetailPage(context),
),
],
);
Widget buildBody(AsyncSnapshot<List<JuDouModel>> snapshot) {
if (snapshot.connectionState != ConnectionState.active) {
return Center(
child: CircularProgressIndicator(),
);
}
return PageView.builder(
itemBuilder: (context, index) {
return IndexPageItem(
onTap: () => indexBloc.toDetailPage(context),
model: snapshot.data[index],
);
},
itemCount: snapshot.data.length,
controller: this._pageController,
onPageChanged: indexBloc.onPageChanged,
);
}
@override
Widget build(BuildContext context) {
super.build(context);
return StreamBuilder(
stream: indexBloc.dailyStream,
builder:
(BuildContext context, AsyncSnapshot<List<JuDouModel>> snapshot) {
return Scaffold(
appBar: indexAppBar(),
backgroundColor: Colors.white,
body: buildBody(snapshot),
);
},
);
}
}
| 0 |
mirrored_repositories/judou/lib/index | mirrored_repositories/judou/lib/index/models/author_model.dart |
class AuthorModel {
final bool isVerified;
final String createDate;
final int id;
final String name;
final int sentencesCount;
final bool isLocked;
final String forbidDate;
final String description;
final String type;
final String coverUrl;
AuthorModel({
this.isVerified,
this.createDate,
this.id,
this.name,
this.sentencesCount,
this.isLocked,
this.forbidDate,
this.description,
this.type,
this.coverUrl
});
factory AuthorModel.fromJson(Map<String, dynamic> json) {
return AuthorModel(
isVerified: json['is_verified'] as bool,
createDate: json['created_at'] as String,
id: json['id'] as int,
name: json['name'] as String,
sentencesCount: json['sentences_count'] as int,
isLocked: json['is_locked'] as bool,
forbidDate: json['forbided_at'] as String,
description: json['description'] as String,
type: json['type'] as String,
coverUrl: json['cover'] as String
);
}
} | 0 |
mirrored_repositories/judou/lib/index | mirrored_repositories/judou/lib/index/models/judou_model.dart | import 'author_model.dart';
import 'image_model.dart';
import 'user_model.dart';
import 'tag_model.dart';
class JuDouModel {
final bool isPrivate;
final List<TagModel> tags;
final String dailyDate;
final String publishedDate;
final bool isAd;
final bool isUsedByWechat;
final bool isEditable;
final AuthorModel author;
final bool isOriginal;
final UserModel user;
final ImageModel image;
final bool isCollected;
final int likeCount;
final bool isUsedByWeibo;
final String shareUrl;
final String maskColor;
final List<ImageModel> pictures;
final bool isLiked;
final bool isRandomable;
final String content;
final int commentCount;
final bool isDisabledComment;
final String maskTransparent;
final String weiboUsedAt;
final String uuid;
final String subHeading;
final bool isUgc;
JuDouModel(
{this.isPrivate,
this.tags,
this.dailyDate,
this.publishedDate,
this.isAd,
this.isUsedByWechat,
this.isEditable,
this.author,
this.isOriginal,
this.user,
this.image,
this.isCollected,
this.likeCount,
this.isUsedByWeibo,
this.shareUrl,
this.maskColor,
this.pictures,
this.isLiked = false,
this.isRandomable,
this.content,
this.commentCount,
this.isDisabledComment,
this.maskTransparent,
this.weiboUsedAt,
this.uuid,
this.subHeading,
this.isUgc});
factory JuDouModel.fromJson(Map<String, dynamic> json) {
var picturesList = json['pictures'] as List;
List<ImageModel> imageList;
if (picturesList != null) {
imageList = picturesList.map((i) => ImageModel.fromJson(i)).toList();
}
var tList = json['tags'] as List;
List<TagModel> tagList;
if (tList != null) {
tagList = tList.map((i) => TagModel.fromJSON(i)).toList();
}
return JuDouModel(
isPrivate: json['is_private'] as bool,
tags: tagList,
dailyDate: json['daily_date'] as String,
publishedDate: json['published_at'] as String,
isAd: json['is_ad'] as bool,
isUsedByWechat: json['is_used_by_wechat'] as bool,
isEditable: json['is_editable'] as bool,
author: json['author'] != null
? AuthorModel.fromJson(json['author'])
: null,
isOriginal: json['is_original'] as bool,
user: json['user'] != null ? UserModel.fromJson(json['user']) : null,
image:
json['image'] != null ? ImageModel.fromJson(json['image']) : null,
isCollected: json['is_collected'] as bool,
likeCount: json['like_count'] as int,
isUsedByWeibo: json['is_used_by_weibo'] as bool,
shareUrl: json['share_url'] as String,
maskColor: json['mask_color'] as String,
pictures: imageList,
isLiked: json['is_liked'] ?? false,
isRandomable: json['is_randomable'] as bool,
content: json['content'] as String,
commentCount: json['comment_count'] as int,
isDisabledComment: json['is_disabled_comment'] as bool,
maskTransparent: json['mask_transparent'] as String,
weiboUsedAt: json['weibo_used_at'] as String,
uuid: json['uuid'] as String,
subHeading: json['subheading'] as String,
isUgc: json['is_ugc'] as bool);
}
}
| 0 |
mirrored_repositories/judou/lib/index | mirrored_repositories/judou/lib/index/models/comment_model.dart | import 'user_model.dart';
class CommentModel {
final bool isSelf;
final int upCount;
final int id;
final String content;
final String threadId;
final bool isLiked;
final String commentableType;
final UserModel user;
final Map<String, dynamic> replyToComment;
final bool isBlock;
final String commentableId;
final String createdAt;
CommentModel({
this.isSelf,
this.upCount,
this.id,
this.content,
this.threadId,
this.isLiked,
this.commentableType,
this.user,
this.replyToComment,
this.isBlock,
this.commentableId,
this.createdAt,
});
factory CommentModel.fromJSON(Map<String, dynamic> json) {
return CommentModel(
isSelf: json['is_self'],
upCount: json['up_count'],
id: json['id'],
content: json['content'],
threadId: json['thread_id'],
isLiked: json['is_liked'],
commentableType: json['commentable_type'],
user: UserModel.fromJson(json['user'] ?? Map()),
replyToComment: json['reply_to_comment'] ?? Map<String, dynamic>(),
isBlock: json['is_block'],
commentableId: json['commentable_id'],
createdAt: json['created_at'],
);
}
}
| 0 |
mirrored_repositories/judou/lib/index | mirrored_repositories/judou/lib/index/models/tag_model.dart | class TagModel {
final String name;
final int id;
final String cover;
final String summary;
final int weight;
final bool isCloseable;
final String publishedAt;
TagModel({
this.name,
this.id,
this.cover,
this.summary,
this.weight,
this.isCloseable,
this.publishedAt,
});
factory TagModel.fromJSON(Map<String, dynamic> json) {
return TagModel(name: json['name'], id: json['id']);
}
}
| 0 |
mirrored_repositories/judou/lib/index | mirrored_repositories/judou/lib/index/models/image_model.dart |
class ImageModel {
final String url;
final String copyRight;
final String color;
final int id;
ImageModel({this.url, this.copyRight, this.color, this.id});
factory ImageModel.fromJson(Map<String, dynamic> json) {
return ImageModel(
url: json['url'] as String,
copyRight: json['copyright'] as String,
color: json['color'] as String,
id: json['id'] as int
);
}
} | 0 |
mirrored_repositories/judou/lib/index | mirrored_repositories/judou/lib/index/models/user_model.dart | class UserModel {
final String nickname;
final String avatar;
final String uid;
UserModel({this.nickname, this.avatar, this.uid});
factory UserModel.fromJson(Map<String, dynamic> json) {
return UserModel(
nickname: json['nickname'] as String,
avatar: json['avatar'] as String,
uid: '${json['uid']}');
}
}
| 0 |
mirrored_repositories/judou/lib/index | mirrored_repositories/judou/lib/index/BLoc/detail_bloc.dart | import 'dart:async';
import '../../network/network.dart';
import '../../index/models/judou_model.dart';
import '../../index/models/comment_model.dart';
class DetailBloc implements BlocBase {
/// 数据流中的类型
/// Map<String, List<CommentModel>>
/// {
/// "hot": List<CommentModel>,
/// "latest": List<CommentModel>
/// "detail": JuDouModel
/// }
final _fetchComments = PublishSubject<Map<String, dynamic>>();
final String uuid;
DetailBloc({this.uuid}) {
fetchData();
}
Stream<Map<String, dynamic>> get commentSteam => _fetchComments.stream;
void fetchData() async {
// JuDouModel
Map<String, dynamic> hot = await sentenceHot(uuid);
if (!_fetchComments.isClosed) {
_fetchComments.sink.add(hot);
}
}
@override
dispose() {
if (!_fetchComments.isClosed) _fetchComments.close();
}
/// 每个句子的热评
/// 每个句子的最新评论
/// 每个句子的详情
Future<Map<String, dynamic>> sentenceHot(String uuid) async {
List<CommentModel> hot = await Request.instance.dio
.get(RequestPath.sentenceHot(uuid))
.then((response) => response.data['data'] as List)
.then((response) =>
response.map((item) => CommentModel.fromJSON(item)).toList());
List<CommentModel> latest = await Request.instance.dio
.get(RequestPath.sentenceLatest(uuid))
.then((response) => response.data['data'] as List)
.then((response) =>
response.map((item) => CommentModel.fromJSON(item)).toList());
JuDouModel detailModel = await Request.instance.dio
.get(RequestPath.sentence(uuid))
.then((response) => JuDouModel.fromJson(response.data));
return {'hot': hot, 'latest': latest, 'detail': detailModel};
}
}
| 0 |
mirrored_repositories/judou/lib/index | mirrored_repositories/judou/lib/index/BLoc/index_bloc.dart | import 'package:flutter/material.dart';
import '../models/judou_model.dart';
import '../../index/pages/detail_page.dart';
import '../../network/network.dart';
import 'dart:async';
class IndexBloc implements BlocBase {
/// 存放所有的model
final _fetchDaily = PublishSubject<List<JuDouModel>>();
/// 顶部的角标数据
/// [0] 评论数
/// [1] 喜欢数
/// [2] '1' 喜欢, '0' 不喜欢
final _badges = PublishSubject<List<String>>();
JuDouModel model = JuDouModel();
List<JuDouModel> _dataList = List<JuDouModel>();
IndexBloc() {
_fetchDailyJson();
}
/// JudouModel数据流
/// 一次性返回
Stream<List<JuDouModel>> get dailyStream => _fetchDaily.stream;
/// 角标数据流
/// 每次发送一个数组,同时包含like和commnet
Stream<List<String>> get badgesSteam => _badges.stream;
/// pageview页面切换回调
void onPageChanged(index) {
model = _dataList[index];
double l = model.likeCount / 1000;
double c = model.commentCount / 1000;
String likeNum =
(l > 1) ? l.toStringAsFixed(1) + 'k' : '${model.likeCount}';
String commentNum =
(c > 1) ? c.toStringAsFixed(1) : '${model.commentCount}';
if (!_badges.isClosed) {
_badges.sink.add([commentNum, likeNum, model.isLiked ? '1' : '0']);
}
}
/// to detail page
void toDetailPage(BuildContext context) {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => DetailPage(model: model)),
);
}
@override
dispose() {
if (!_fetchDaily.isClosed) _fetchDaily.close();
if (!_badges.isClosed) _badges.close();
}
void _fetchDailyJson() async {
List<JuDouModel> list = await daily();
if (!_fetchDaily.isClosed) {
_fetchDaily.sink.add(list);
}
_dataList = list;
this.onPageChanged(0);
}
/// 首页网络请求
Future<List<JuDouModel>> daily() async {
List<JuDouModel> list = await Request.instance.dio
.get(RequestPath.daily)
.then((response) => response.data['data'] as List)
.then((response) => response.where((item) => !item['is_ad']).toList())
.then((response) =>
response.map((item) => JuDouModel.fromJson(item)).toList());
// var dio = Dio();
// dio.onHttpClientCreate = (HttpClient client) {
// client.idleTimeout = Duration(seconds: 1);
// };
// Directory appDocDir = await getApplicationDocumentsDirectory();
// String appDocPath = appDocDir.path;
// try {
// Response response = await dio.download(
// 'http://flv2.bn.netease.com/videolib3/1707/07/liHAU2643/HD/liHAU2643-mobile.mp4',
// '$appDocPath/test.mp4', onProgress: (received, total) {
// print('received----- $received total******** $total');
// });
// print(response.data);
// } catch (e) {
// print('error -> $e');
// }
// print("download succeed!");
return list;
}
}
| 0 |
mirrored_repositories/judou | mirrored_repositories/judou/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:judou/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(JuDouApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
| 0 |
mirrored_repositories/pizza-animation | mirrored_repositories/pizza-animation/lib/main.dart | import 'package:pizza_animation/routes/routes.dart';
import 'package:pizza_animation/services/nav_service.dart';
import 'package:pizza_animation/services/size_config.dart';
import 'package:pizza_animation/view_models/ingridients_view_model.dart';
import 'package:pizza_animation/view_models/pizza_view_model.dart';
import 'package:pizza_animation/view_models/user_data_provider.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(
MultiProvider(
providers: [
ChangeNotifierProvider(create: (ctx) => IngridientsViewModel()),
ChangeNotifierProvider(create: (ctx) => PizzaViewModel()),
ChangeNotifierProvider<UserDataProvider>(
create: (context) => UserDataProvider()),
],
child: MaterialApp(
builder: (BuildContext context, Widget? child) {
SizeConfig().init(context);
final data = MediaQuery.of(context);
return MediaQuery(
data: data.copyWith(textScaleFactor: 1),
child: child!,
);
},
title: 'Pizza',
debugShowCheckedModeBanner: false,
initialRoute: SetupRoutes.initialRoute,
routes: SetupRoutes.routes,
navigatorKey: NavService.navKey,
theme: ThemeData(
fontFamily: 'Montserrat',
),
),
),
);
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/routes/routes.dart | import 'package:pizza_animation/routes/route_names.dart';
import 'package:pizza_animation/screens/checkout_screen.dart';
import 'package:pizza_animation/screens/diy_pizza_screen.dart';
import 'package:pizza_animation/screens/home_screen.dart';
import 'package:pizza_animation/screens/pizza_selection_screen.dart';
import 'package:pizza_animation/screens/splash/splash.dart';
import 'package:pizza_animation/screens/splash_screen.dart';
import 'package:pizza_animation/screens/user_form/user_form.dart';
import 'package:flutter/material.dart';
class SetupRoutes {
static String initialRoute = Routes.SPLASH;
static String dIYPizza = Routes.DIYPIZZA;
static String pizzaSelection = Routes.PIZZASELECTION;
static String checkoutPage = Routes.CHECKOUT;
// static String initialRoute = Routes.ADD_LINK;
static Map<String, WidgetBuilder> get routes {
return {
Routes.SPLASH: (context) => Splash(),
Routes.USER_FORM: (context) => UserForm(),
Routes.DIYPIZZA: (context) {
return DIYPizzaScreen();
},
Routes.PIZZASELECTION: (context) {
return PizzaSelection();
},
Routes.CHECKOUT: (context) {
return CheckoutPage();
},
Routes.HOME: (context) {
return Home();
},
Routes.ONBOARDING: (context) {
return Onboarding();
}
};
}
static Future push(BuildContext context, String value,
{Object? arguments, Function? callbackAfterNavigation}) {
return Navigator.of(context)
.pushNamed(value, arguments: arguments)
.then((response) {
if (callbackAfterNavigation != null) {
callbackAfterNavigation();
}
});
}
// ignore: always_declare_return_types
static replace(BuildContext context, String value,
{dynamic arguments, Function? callbackAfterNavigation}) {
Navigator.of(context)
.pushReplacementNamed(value, arguments: arguments)
.then((response) {
if (callbackAfterNavigation != null) {
callbackAfterNavigation();
}
});
}
// ignore: always_declare_return_types
static pushAndRemoveAll(BuildContext context, String value,
{dynamic arguments, Function? callbackAfterNavigation}) {
Navigator.of(context)
.pushNamedAndRemoveUntil(
value,
(_) => false,
arguments: arguments,
)
.then((response) {
if (callbackAfterNavigation != null) {
callbackAfterNavigation();
}
});
}
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/routes/route_names.dart | class Routes {
static const String SPLASH = 'splash';
static const String HOME = 'home';
static const String DIYPIZZA = 'diypizza';
static const String PIZZASELECTION = 'pizzaselection';
static const String CHECKOUT = 'checkout';
static const String USER_FORM = 'user_form';
static const String ONBOARDING = 'onboarding';
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/components/pizza.dart | import 'dart:async';
import 'package:pizza_animation/components/pizza_topping.dart';
import 'package:pizza_animation/screens/diy_pizza_screen.dart';
import 'package:pizza_animation/services/size_config.dart';
import 'package:pizza_animation/utils/constants.dart';
import 'package:pizza_animation/view_models/ingridients_view_model.dart';
import 'package:pizza_animation/view_models/pizza_view_model.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:screenshot/screenshot.dart';
class Pizza extends StatefulWidget {
final Animation<double> scale;
final ScreenshotController screenshotController;
final AnimationController controller;
final String? pizzaPath;
const Pizza({
Key? key,
required this.scale,
required this.controller,
required this.screenshotController,
this.pizzaPath,
}) : super(key: key);
@override
_PizzaState createState() => _PizzaState();
}
class _PizzaState extends State<Pizza> with TickerProviderStateMixin {
late AnimationController fadePlateAnimationController;
late Animation<double> fadePlateVal;
bool hasMovedIn = false;
@override
void initState() {
super.initState();
fadePlateAnimationController = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 1000),
);
PizzaViewModel pizzaViewModel = context.read<PizzaViewModel>();
pizzaViewModel.pizzaAnimationController = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 600),
);
fadePlateVal =
Tween<double>(begin: 0, end: 1).animate(fadePlateAnimationController);
pizzaViewModel.pizzaXVal = Tween<double>(begin: 500, end: 0).animate(
CurvedAnimation(
parent: pizzaViewModel.pizzaAnimationController,
curve: Curves.easeIn,
reverseCurve: Curves.easeOut,
),
);
fadePlateAnimationController.forward();
Timer(const Duration(milliseconds: 800), () {
pizzaViewModel.pizzaAnimationController.forward();
});
}
@override
Widget build(BuildContext context) {
final ingridientsProvider =
Provider.of<IngridientsViewModel>(context, listen: true);
final pizzaViewModel = Provider.of<PizzaViewModel>(context, listen: true);
var pizzaSize =
MediaQuery.of(context).size.width / 2 - Constants.PIZZAPADDING;
return Container(
padding: EdgeInsets.symmetric(vertical: 10.toHeight),
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 20,
blurRadius: 20,
offset: const Offset(0, 14), // changes position of shadow
),
],
shape: BoxShape.circle,
),
child: Screenshot(
controller: widget.screenshotController,
child: DragTarget<Ingridients>(
builder: (ctx, candidate, ejects) {
return ScaleTransition(
scale: widget.scale,
child: Stack(children: [
Container(
decoration: const BoxDecoration(
shape: BoxShape.circle,
),
// height: (pizzaSize * 2 - 42).toHeight,
//change Plate setting
height: (pizzaSize * 1.96).toHeight,
child: FadeTransition(
opacity: fadePlateVal,
//PLATE_IMAGE
child: Image.asset("assets/Plate.png"),
),
),
AnimatedBuilder(
animation: pizzaViewModel.pizzaAnimationController,
builder: (ctx, child) {
return Transform.translate(
offset: Offset(pizzaViewModel.pizzaXVal.value, 0),
child: child,
);
},
child: Padding(
padding: const EdgeInsets.all(14.0),
child: Image.asset(
widget.pizzaPath ?? pizzaViewModel.getSauceType(),
),
),
),
if (ingridientsProvider.ingridients.length > 0)
for (int i = 0;
i < ingridientsProvider.ingridients.length;
i++)
for (int x = 0; x < 10; x++)
Builder(
builder: (ctx) {
var data = getIngridientsBasePath(
ingridientsProvider.ingridients[i],
x,
);
return PizzaToppingItem(
index: x,
ingridentIndex: i,
path: data['path'],
pizzaSize: pizzaSize,
toppingSize: data['size'],
);
},
)
]),
);
},
onAccept: (ingridient) {
setState(() {
hasMovedIn = false;
});
ingridientsProvider.addIngridient(ingridient);
pizzaViewModel.incPizzaPrice();
widget.controller.reverse();
},
onMove: (ingridient) {
if (!hasMovedIn) {
widget.controller.forward();
setState(() {
hasMovedIn = true;
});
}
},
onLeave: (ingridient) {
widget.controller.reverse();
setState(() {
hasMovedIn = false;
});
},
),
),
);
}
Map<String, dynamic> getIngridientsBasePath(
Ingridients ingridient, int index) {
if (ingridient == Ingridients.BASIL) {
return {"path": Constants.BASIL[index], "size": 48.0};
} else if (ingridient == Ingridients.BROCCOLI) {
return {"path": Constants.BROCCOLI[index], "size": 37.0};
} else if (ingridient == Ingridients.MASHROOM) {
return {"path": Constants.MASHROOM[index], "size": 58.0};
} else if (ingridient == Ingridients.ONION) {
return {"path": Constants.ONION[index], "size": 46.0};
} else if (ingridient == Ingridients.SAUSAGE) {
return {"path": Constants.SAUSAGE[index], "size": 42.0};
}
return {};
}
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/components/pizza_topping.dart | import 'dart:async';
import 'dart:math' as math;
import 'package:pizza_animation/services/size_config.dart';
import 'package:pizza_animation/view_models/ingridients_view_model.dart';
import 'package:pizza_animation/view_models/pizza_view_model.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class PizzaToppingItem extends StatefulWidget {
final String path;
final double pizzaSize;
final int index;
final int ingridentIndex;
final double toppingSize;
PizzaToppingItem({
Key? key,
required this.path,
required this.pizzaSize,
required this.index,
required this.ingridentIndex,
required this.toppingSize,
}) : super(key: key);
@override
_PizzaToppingItemState createState() => _PizzaToppingItemState();
}
class _PizzaToppingItemState extends State<PizzaToppingItem>
with TickerProviderStateMixin {
late double radius, x, y, theta;
List<double> randomPizzaRadius = [];
late Animation<double> scaleAnimation;
late AnimationController controller;
removeIngridient(BuildContext context) {
context
.read<IngridientsViewModel>()
.removeIngridient(widget.ingridentIndex);
}
@override
void initState() {
super.initState();
theta = (2 * math.pi * widget.index) / 10;
y = 0;
if (theta > math.pi / 2 && theta < (math.pi + math.pi / 2))
x = -500;
else
x = 500;
setState(() {});
math.Random random = new math.Random();
controller = AnimationController(
duration: Duration(milliseconds: random.nextInt(300) + 100),
vsync: this,
);
scaleAnimation = Tween<double>(
begin: 1.6,
end: 1,
).animate(CurvedAnimation(
parent: controller,
curve: Curves.easeOut,
));
Timer(Duration(milliseconds: 1), () {
double radius = [
widget.pizzaSize * 0.3,
widget.pizzaSize * 0.5,
widget.pizzaSize * 0.7
][random.nextInt(3)];
x = widget.pizzaSize - 10 + radius * math.cos(theta);
y = widget.pizzaSize - 10 + radius * math.sin(theta);
controller.forward();
setState(() {});
});
}
@override
Widget build(BuildContext context) {
final pizzaViewModel = context.watch<PizzaViewModel>();
if (pizzaViewModel.scaleAnimateForward) {
controller.forward();
}
if (pizzaViewModel.scaleAnimateReverse) {
controller.reverse();
}
math.Random random = new math.Random();
return AnimatedPositioned(
duration: Duration(milliseconds: random.nextInt(800) + 100),
curve: Curves.bounceIn,
top: y,
left: x,
child: GestureDetector(
onTap: () {
removeIngridient(context);
pizzaViewModel.decPizzaPrice();
},
child: ScaleTransition(
scale: scaleAnimation,
child: Image(
image: AssetImage(widget.path),
height: widget.toppingSize.toHeight,
width: widget.toppingSize.toWidth,
),
),
),
);
}
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/components/topbar.dart | import 'package:pizza_animation/services/size_config.dart';
import 'package:pizza_animation/utils/colors.dart';
import 'package:pizza_animation/utils/text_styles.dart';
import 'package:flutter/material.dart';
class TopBar extends StatelessWidget {
final int? selectedCard;
const TopBar({
Key? key,
required this.selectedCard,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
height: 60.toHeight,
padding: EdgeInsets.symmetric(horizontal: 16.toWidth),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
GestureDetector(
onTap: () => Navigator.of(context).pop(),
child: Container(
child: Icon(
Icons.chevron_left,
size: 40.toFont,
color: ColorConstants.Blue_Gray,
),
),
),
Expanded(
child: Container(
alignment: Alignment.center,
child: AnimatedOpacity(
opacity: 1,
duration: Duration(milliseconds: 400),
child: Text(
"Checkout",
style: CustomTextStyles.orderPizza(size: 30),
),
),
),
)
],
),
);
}
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/components/card_details.dart | import 'package:pizza_animation/components/cutlery.dart';
import 'package:pizza_animation/components/deliver_price.dart';
import 'package:pizza_animation/components/order_list.dart';
import 'package:pizza_animation/components/pay_now.dart';
import 'package:pizza_animation/services/size_config.dart';
import 'package:pizza_animation/utils/text_styles.dart';
import 'package:pizza_animation/view_models/ingridients_view_model.dart';
import 'package:pizza_animation/view_models/pizza_view_model.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class CardDetails extends StatelessWidget {
final Animation<double> spendContainerOpacity;
final int? selectedCard;
final Function onPayNow;
const CardDetails({
Key? key,
required this.spendContainerOpacity,
this.selectedCard,
required this.onPayNow,
}) : super(key: key);
@override
Widget build(BuildContext context) {
final pizzaViewModel = context.watch<PizzaViewModel>();
final ingridientsViewModel = context.watch<IngridientsViewModel>();
return Expanded(
child: FadeTransition(
opacity: spendContainerOpacity,
child: Container(
width: double.infinity,
padding: EdgeInsets.only(
left: 20.toWidth,
right: 20.toWidth,
),
child: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
/// Delivery Time
Text(
"We will deliver in\n24 minutes to this address:",
style: CustomTextStyles.delivery(),
),
SizedBox(height: 15.toHeight),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
"Atlanta shopping mall, Surat",
style: CustomTextStyles.delivery(size: 14.toFont),
),
SizedBox(width: 10.toWidth),
Text(
"Change Address",
style: CustomTextStyles.changeAddress(),
),
],
),
/// Pizza Order List
SizedBox(height: 15.toHeight),
Divider(color: Colors.black.withOpacity(0.2)),
OrderList(
pizzaViewModel: pizzaViewModel,
ingridientsViewModel: ingridientsViewModel,
),
SizedBox(height: 5.toHeight),
Divider(color: Colors.black.withOpacity(0.2)),
/// Cutlery Count
Cutlery(),
Divider(color: Colors.black.withOpacity(0.2)),
SizedBox(height: 10.toHeight),
/// Delivery Price
DeliveryPrice(),
SizedBox(height: 20.toHeight),
],
),
),
),
/// Pay Now widget
GestureDetector(
onTap: () => onPayNow(),
child: PayNowWidget(
selectedCard: selectedCard,
pizzaViewModel: pizzaViewModel,
),
),
],
),
),
),
);
}
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/components/deliver_price.dart | import 'package:pizza_animation/utils/text_styles.dart';
import 'package:flutter/material.dart';
class DeliveryPrice extends StatelessWidget {
const DeliveryPrice({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Delivery",
style: CustomTextStyles.commonMontserrat(
fontWeight: FontWeight.bold,
size: 15,
),
),
SizedBox(height: 5),
Text(
"Free delivery from \₹15",
style: CustomTextStyles.commonMontserrat(size: 15),
),
],
),
Text(
"\₹0.00",
style: CustomTextStyles.commonMontserrat(
fontWeight: FontWeight.bold,
size: 18,
),
),
],
);
}
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/components/order_list.dart | import 'package:pizza_animation/screens/diy_pizza_screen.dart';
import 'package:pizza_animation/services/size_config.dart';
import 'package:pizza_animation/utils/text_styles.dart';
import 'package:pizza_animation/view_models/ingridients_view_model.dart';
import 'package:pizza_animation/view_models/pizza_view_model.dart';
import 'package:flutter/material.dart';
class OrderList extends StatelessWidget {
final PizzaViewModel pizzaViewModel;
final IngridientsViewModel ingridientsViewModel;
const OrderList({
Key? key,
required this.pizzaViewModel,
required this.ingridientsViewModel,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
child: Row(
children: [
Container(
width: 110.toWidth,
height: 110.toHeight,
padding: EdgeInsets.all(15),
child: Image.memory(pizzaViewModel.pizzaImage),
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
pizzaViewModel.selectedPizzaObj['name'] ?? "Pizza",
style: CustomTextStyles.commonMontserrat(),
),
SizedBox(height: 8),
Text(
"Extra Toppings",
style: CustomTextStyles.commonMontserrat(
color: Colors.grey[500],
size: 15,
),
),
Text(
getIngridients(ingridientsViewModel.ingridients),
maxLines: 3,
style: CustomTextStyles.commonMontserrat(size: 15),
),
],
),
),
Container(
padding: EdgeInsets.all(15),
child: Text(
"\₹${pizzaViewModel.pizzaPrice.toInt().toString()}.00",
style: CustomTextStyles.commonMontserrat(size: 20),
),
),
],
),
);
}
getIngridients(List<Ingridients> ingridients) {
String ingridientsString = '';
ingridients.forEach((ingridient) {
if (ingridient == Ingridients.BASIL)
ingridientsString += 'Basil, ';
else if (ingridient == Ingridients.BROCCOLI)
ingridientsString += 'Broccoli, ';
else if (ingridient == Ingridients.MASHROOM)
ingridientsString += 'Mashroom, ';
else if (ingridient == Ingridients.ONION)
ingridientsString += 'Onion, ';
else if (ingridient == Ingridients.SAUSAGE)
ingridientsString += 'Sausage, ';
});
return ingridientsString != ""
? ingridientsString.substring(0, ingridientsString.length - 2)
: "";
}
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/components/card_clipper.dart | import 'package:flutter/material.dart';
class CardShinyClipper extends CustomClipper<Path> {
@override
Path getClip(Size size) {
final path = Path();
path.moveTo(0, 0);
path.lineTo(0, size.height * 0.60);
path.quadraticBezierTo(size.width / 2, size.height * 0.7, size.width, 0);
path.lineTo(0, 0);
path.close();
return path;
}
@override
bool shouldReclip(CardShinyClipper oldClipper) => false;
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/components/ingridient.dart | import 'package:pizza_animation/screens/diy_pizza_screen.dart';
import 'package:pizza_animation/services/size_config.dart';
import 'package:pizza_animation/utils/constants.dart';
import 'package:flutter/material.dart';
class Ingridient extends StatelessWidget {
final Ingridients path;
const Ingridient({Key? key, required this.path}) : super(key: key);
@override
Widget build(BuildContext context) {
return Draggable<Ingridients>(
data: path,
child: Image(
image: AssetImage(getIngridientsPath(path)),
height: 50.toHeight,
width: 50.toWidth,
),
feedback: Image(
image: AssetImage(getIngridientsPath(path)),
height: 50.toHeight,
width: 50.toWidth,
),
childWhenDragging: Container(),
);
}
getIngridientsPath(Ingridients ingridient) {
if (ingridient == Ingridients.BASIL)
return Constants.BASIL[0];
else if (ingridient == Ingridients.BROCCOLI)
return Constants.BROCCOLI[0];
else if (ingridient == Ingridients.MASHROOM)
return Constants.MASHROOM[5];
else if (ingridient == Ingridients.ONION)
return Constants.ONION[0];
else if (ingridient == Ingridients.SAUSAGE) return Constants.SAUSAGE[0];
}
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/components/pizzaBg.dart | import 'dart:math' as math;
import 'package:pizza_animation/services/size_config.dart';
import 'package:pizza_animation/utils/constants.dart';
import 'package:flutter/material.dart';
class PizzaBg extends StatefulWidget {
PizzaBg({Key? key}) : super(key: key);
@override
_PizzaBgState createState() => _PizzaBgState();
}
class _PizzaBgState extends State<PizzaBg> {
@override
Widget build(BuildContext context) {
return Container(
width: MediaQuery.of(context).size.width,
alignment: Alignment.center,
child: Center(
child: Container(
width: 340.toWidth,
height: 340.toHeight,
decoration: BoxDecoration(
shape: BoxShape.circle,
),
child: Stack(
children: [
for (int i = 0; i < Constants.EXTRA.length; i++)
PizzaBgTopping(
width: MediaQuery.of(context).size.width,
index: i,
),
],
),
),
),
);
}
}
class PizzaBgTopping extends StatefulWidget {
final double width;
final int index;
const PizzaBgTopping({
Key? key,
required this.index,
required this.width,
}) : super(key: key);
@override
_PizzaBgToppingState createState() => _PizzaBgToppingState();
}
class _PizzaBgToppingState extends State<PizzaBgTopping> {
late double radius, x, y, theta;
@override
void initState() {
super.initState();
radius = 160;
theta = (2 * math.pi * widget.index) / Constants.EXTRA.length;
x = 156 + radius * math.cos(theta);
y = 162 + radius * math.sin(theta);
}
@override
Widget build(BuildContext context) {
return Positioned(
top: x.toHeight,
left: y.toWidth,
child: Container(
child: Image(
image: AssetImage(
Constants.EXTRA[widget.index]['path'],
),
height: Constants.EXTRA[widget.index]['size'],
width: Constants.EXTRA[widget.index]['size'],
),
),
);
}
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/components/gradient_text.dart | import 'package:flutter/material.dart';
class GradientText extends StatelessWidget {
GradientText(
this.text, {
required this.gradient,
required this.fontSize,
required this.letterSpacing,
});
final String text;
final Gradient gradient;
final double fontSize;
final double letterSpacing;
@override
Widget build(BuildContext context) {
return ShaderMask(
shaderCallback: (bounds) => gradient.createShader(
Rect.fromLTRB(0, bounds.bottom, 0, bounds.top),
),
child: Text(
text,
style: TextStyle(
fontFamily: "Montserrat",
letterSpacing: letterSpacing,
fontSize: fontSize,
color: Colors.white,
// fontWeight: FontWeight.w700,
shadows: <Shadow>[
Shadow(
offset: Offset(1.5, 1.5),
blurRadius: 3.0,
color: Colors.black,
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/components/cards_container.dart | import 'package:pizza_animation/components/card_clipper.dart';
import 'package:pizza_animation/components/gradient_text.dart';
import 'package:pizza_animation/models/card_model.dart';
import 'package:pizza_animation/services/size_config.dart';
import 'package:pizza_animation/utils/constants.dart';
import 'package:flutter/material.dart';
class CardsContainer extends StatefulWidget {
final Animation containerHeightAnimation;
final Animation cardXAnimation;
final Animation<double> cardSize;
final Animation cardTransform;
final Animation<dynamic> cardHeightAnimation;
final AnimationController animationController;
final Function updateIsDetailOpen;
CardsContainer({
Key? key,
required this.containerHeightAnimation,
required this.animationController,
required this.cardXAnimation,
required this.cardSize,
required this.cardTransform,
required this.cardHeightAnimation,
required this.updateIsDetailOpen,
}) : super(key: key);
@override
_CardsContainerState createState() => _CardsContainerState();
}
class _CardsContainerState extends State<CardsContainer> {
int? selectedCard;
double x = 0.50;
double y = 0.01;
double height = 200;
@override
Widget build(BuildContext context) {
double width = MediaQuery.of(context).size.width;
return AnimatedBuilder(
animation: widget.containerHeightAnimation,
builder: (context, child) {
return Container(
height: widget.containerHeightAnimation.value,
child: Listener(
onPointerMove: (PointerMoveEvent moveEvent) {
if (selectedCard != null) {
setState(() {
selectedCard = null;
});
}
if (moveEvent.delta.dy > 0) {
if (widget.animationController.status !=
AnimationStatus.completed) {
widget.animationController.forward();
}
}
if (moveEvent.delta.dy < 0) {
if (widget.animationController.status ==
AnimationStatus.completed) {
widget.animationController.reverse();
widget.updateIsDetailOpen(false, null);
}
}
},
child: Stack(
children: [
for (int i = 0; i < Constants.cardModel.length; i++)
AnimatedPositioned(
duration: Duration(milliseconds: 500),
top: selectedCard == null
? getTop(i)
: selectedCard == i
? 0
: 500,
left: 27,
child: AnimatedOpacity(
opacity: selectedCard == null
? 1
: selectedCard == i
? 1
: 0,
duration: Duration(milliseconds: 400),
child: Transform(
transform: Matrix4.identity()
..setEntry(3, 2, 0.001)
..rotateX(selectedCard == null
? widget.cardXAnimation.value +
((i + 1) * 5) / 100
: selectedCard == i
? 0
: widget.cardXAnimation.value +
((i + 1) * 5) / 100),
alignment: FractionalOffset.center,
child: Transform.scale(
scale: widget.cardSize.value + (i + 1) / 120,
child: GestureDetector(
onTap: () {
setState(() {
selectedCard = i;
});
widget.updateIsDetailOpen(true, i);
widget.animationController.reverse();
},
child: CreditCard(
height: height,
width: width,
cardModel: Constants.cardModel[i],
),
),
),
),
),
),
],
),
),
);
},
);
}
double getTop(int i) {
return (((i + 1) * 10 +
i * widget.cardTransform.value * 460 +
(widget.cardHeightAnimation.value * 200 as double)));
}
}
class CreditCard extends StatelessWidget {
CreditCard({
Key? key,
required this.height,
required this.width,
required this.cardModel,
}) : super(key: key);
final double height;
final double width;
final CardModel cardModel;
@override
Widget build(BuildContext context) {
return Stack(
children: [
Container(
height: height + 10,
width: width - 54,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(17),
gradient: new LinearGradient(
colors: cardModel.borderContainer1,
begin: Alignment.centerLeft,
end: Alignment.centerRight,
stops: [0.0, 0.5, 1.0],
tileMode: TileMode.clamp,
),
),
child: Container(
height: height + 10,
width: width - 54,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(17),
gradient: new LinearGradient(
colors: cardModel.borderContainer2,
begin: Alignment.bottomCenter,
end: Alignment.center,
stops: [0.0, 0.5],
tileMode: TileMode.clamp,
),
),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
gradient: new LinearGradient(
colors: cardModel.bottomContainer,
begin: Alignment.centerLeft,
end: Alignment.topRight,
stops: [0.0, 0.9, 1.0],
tileMode: TileMode.clamp,
),
),
child: ClipPath(
clipper: CardShinyClipper(),
child: Container(
height: height,
width: width - 60,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
gradient: new LinearGradient(
colors: cardModel.topCurveContainer,
begin: Alignment.bottomLeft,
end: Alignment.topRight,
stops: [0.0, 1.0],
tileMode: TileMode.clamp,
),
),
),
),
),
),
),
Positioned(
top: 20.toHeight,
left: 20.toWidth,
child: GradientText(cardModel.title.toUpperCase(),
gradient: LinearGradient(
colors: [
Colors.grey[700]!,
Colors.white,
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
fontSize: 20,
letterSpacing: 3.5),
),
Positioned(
bottom: 20.toHeight,
left: 20.toWidth,
child: GradientText(
"\₹" + cardModel.amount.toString().toUpperCase(),
gradient: LinearGradient(
colors: [
Colors.grey[700]!,
Colors.white,
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
fontSize: 36,
letterSpacing: 1,
),
),
Positioned(
bottom: -40.toHeight,
right: -40.toWidth,
child: Container(
child: Image.asset(
cardModel.pizzaBgImage,
height: 180.toHeight,
),
),
),
],
);
}
final Shader linearGradient = LinearGradient(
colors: <Color>[Color(0xffDA44bb), Color(0xff8921aa)],
).createShader(Rect.fromLTWH(0.0, 0.0, 200.0, 70.0));
}
extension GlobalKeyExtension on GlobalKey {
Rect? get globalPaintBounds {
var renderObject = currentContext?.findRenderObject();
var translation = renderObject?.getTransformTo(null).getTranslation();
if (translation != null) {
return renderObject!.paintBounds
.shift(Offset(translation.x, translation.y));
} else {
return null;
}
}
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/components/pay_now.dart | import 'package:pizza_animation/services/size_config.dart';
import 'package:pizza_animation/utils/colors.dart';
import 'package:pizza_animation/utils/text_styles.dart';
import 'package:pizza_animation/view_models/pizza_view_model.dart';
import 'package:flutter/material.dart';
class PayNowWidget extends StatelessWidget {
const PayNowWidget({
Key? key,
required this.selectedCard,
required this.pizzaViewModel,
}) : super(key: key);
final int? selectedCard;
final PizzaViewModel pizzaViewModel;
@override
Widget build(BuildContext context) {
return Container(
height: 60.toHeight,
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: ColorConstants.Blue_Gray,
),
child: Row(
children: [
SizedBox(width: 20),
Text(
"Pay Now",
style: CustomTextStyles.commonMontserrat(
fontWeight: FontWeight.bold,
size: 18,
color: Colors.white,
),
),
Spacer(),
RichText(
text: TextSpan(
children: [
TextSpan(
text: "24 min ",
style: CustomTextStyles.commonMontserrat(
fontWeight: FontWeight.bold,
size: 16,
color: Colors.white,
),
),
TextSpan(
text:
"• \₹${pizzaViewModel.pizzaPrice.toInt().toString()}.00",
style: CustomTextStyles.commonMontserrat(
fontWeight: FontWeight.bold,
size: 18,
color: Colors.white,
),
)
],
),
),
SizedBox(width: 20.toWidth),
],
),
);
}
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/components/spend_container.dart | import 'package:pizza_animation/services/size_config.dart';
import 'package:flutter/material.dart';
class SpendsContainer extends StatelessWidget {
final Animation<double> spendContainerOpacity;
const SpendsContainer({
Key? key,
required this.spendContainerOpacity,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Expanded(
child: FadeTransition(
opacity: spendContainerOpacity,
child: SingleChildScrollView(
child: Container(
width: double.infinity,
padding: EdgeInsets.only(
left: 20.toWidth,
right: 20.toWidth,
),
// color: Colors.red,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
height: 30.toHeight,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
child: Text(
"Spends",
style: TextStyle(
fontFamily: "Montserrat",
fontSize: 22.toFont,
),
),
),
Expanded(
child: Container(
margin: EdgeInsets.only(left: 10.toWidth),
height: 2.toHeight,
color: Colors.grey[300],
),
)
],
),
),
Row(
children: [
Expanded(child: Image.asset("assets/limit.png"), flex: 2),
Expanded(
child: Image.asset("assets/this-week.png"), flex: 2),
],
),
Image.asset("assets/peek.png")
],
),
),
),
),
);
}
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/components/cutlery.dart | import 'package:pizza_animation/services/size_config.dart';
import 'package:pizza_animation/utils/text_styles.dart';
import 'package:flutter/material.dart';
class Cutlery extends StatefulWidget {
const Cutlery({
Key? key,
}) : super(key: key);
@override
_CutleryState createState() => _CutleryState();
}
class _CutleryState extends State<Cutlery> {
int cutlery = 1;
@override
Widget build(BuildContext context) {
return Container(
height: 60.toHeight,
width: double.infinity,
child: Row(
children: [
SizedBox(width: 40.toWidth),
Icon(Icons.restaurant),
Expanded(
child: Center(
child: Text(
"Cutlery",
style: CustomTextStyles.commonMontserrat(size: 19),
),
),
),
Row(children: [
GestureDetector(
onTap: () {
if (cutlery > 0) {
setState(() {
cutlery--;
});
}
},
child: Container(
width: 40.toWidth,
height: 40.toHeight,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.grey[300],
),
child: Center(
child: Text(
"-",
style: CustomTextStyles.commonMontserrat(size: 20),
),
),
),
),
SizedBox(width: 10.toWidth),
Text(
cutlery.toString(),
style: CustomTextStyles.commonMontserrat(size: 20),
),
SizedBox(width: 10.toWidth),
GestureDetector(
onTap: () {
if (cutlery < 10) {
setState(() {
cutlery++;
});
}
},
child: Container(
width: 40.toWidth,
height: 40.toHeight,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.grey[300],
),
child: Center(
child: Text(
"+",
style: CustomTextStyles.commonMontserrat(size: 20),
),
),
),
)
]),
],
),
);
}
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/components/pizza_details.dart | import 'package:pizza_animation/services/size_config.dart';
import 'package:pizza_animation/utils/colors.dart';
import 'package:pizza_animation/utils/text_styles.dart';
import 'package:flutter/material.dart';
class PizzaDetails extends StatelessWidget {
const PizzaDetails({
Key? key,
required this.pizzaObj,
}) : super(key: key);
final Map<String, dynamic> pizzaObj;
@override
Widget build(BuildContext context) {
return Container(
height: 300.toHeight,
width: 250.toWidth,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(125),
bottomRight: Radius.circular(125),
),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.2),
spreadRadius: 20,
blurRadius: 50,
offset: Offset(0, 50),
// changes position of shadow
),
],
color: Colors.white,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 30.toHeight),
Text(
// "Test",
pizzaObj["name"],
style: CustomTextStyles.pizzaName(),
),
SizedBox(height: 20.toHeight),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
for (int i = 1; i <= pizzaObj["rating"]; i++)
Icon(
Icons.star,
color: ColorConstants.amber,
size: 25.toFont,
),
for (int i = 1; i <= 5 - pizzaObj["rating"]; i++)
Icon(
Icons.star_border,
color: ColorConstants.amber,
size: 25.toFont,
),
],
),
SizedBox(height: 30),
Text(
"\₹${pizzaObj['price']}",
style: CustomTextStyles.priceStyle(size: 50),
)
],
),
);
}
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/models/card_model.dart | import 'package:flutter/material.dart';
class CardModel {
final String title;
final int amount;
final List<Color> borderContainer1;
final List<Color> borderContainer2;
final List<Color> bottomContainer;
final List<Color> topCurveContainer;
final String pizzaBgImage;
CardModel({
required this.title,
required this.amount,
required this.borderContainer1,
required this.borderContainer2,
required this.bottomContainer,
required this.topCurveContainer,
required this.pizzaBgImage,
});
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/model/user_data.dart | class UserData {
UserData(
{required this.name,
required this.phoneNumber,
this.email,
required this.address});
final String name;
final String phoneNumber;
final String? email;
final String address;
UserData.fromJson(Map<String, Object?> json)
: this(
name: json['name']! as String,
phoneNumber: json['phoneNumber']! as String,
address: json['address']! as String,
email: (json['email'] != null ? (json['email']! as String) : ''),
);
Map<String, Object?> toJson() {
return {
'name': name,
'phoneNumber': phoneNumber,
'address': address,
'email': email ?? '',
};
}
@override
String toString() {
return 'name: $name, phoneNumber: $phoneNumber, address: $address, email: $email';
}
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/common_components/loading_widget.dart | import 'package:pizza_animation/common_components/custom_popup_route.dart';
import 'package:pizza_animation/common_components/triple_dot_loading.dart';
import 'package:pizza_animation/services/nav_service.dart';
import 'package:pizza_animation/utils/colors.dart';
import 'package:pizza_animation/services/size_config.dart';
import 'package:flutter/material.dart';
class LoadingDialog {
LoadingDialog._();
static final LoadingDialog _instance = LoadingDialog._();
factory LoadingDialog() => _instance;
bool _showing = false;
// ignore: always_declare_return_types
show({String? text, String? heading}) {
if (!_showing) {
_showing = true;
NavService.navKey.currentState!
.push(CustomPopupRoutes(
pageBuilder: (_, __, ___) {
print('building loader');
return Center(
child: (text != null)
? Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
heading != null
? Center(
child: Text(heading,
style: TextStyle(
color: ColorConstants.MILD_GREY,
fontSize: 20.toFont,
fontWeight: FontWeight.w400,
decoration: TextDecoration.none)),
)
: SizedBox(),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Flexible(
child: Text(
text,
textScaleFactor: 1,
style: TextStyle(
color: ColorConstants.MILD_GREY,
fontSize: 20.toFont,
fontWeight: FontWeight.w400,
decoration: TextDecoration.none),
),
),
TypingIndicator(
showIndicator: true,
flashingCircleBrightColor:
ColorConstants.LIGHT_GREY,
flashingCircleDarkColor:
ColorConstants.DARK_GREY,
),
],
),
],
)
: CircularProgressIndicator(),
);
},
barrierDismissible: false))
.then((_) {});
}
}
onlyText(String text, {TextStyle? style}) {
return Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Flexible(
child: Text(
text,
textScaleFactor: 1,
style: style ??
TextStyle(
color: ColorConstants.DARK_GREY,
fontSize: 20.toFont,
fontWeight: FontWeight.w400,
decoration: TextDecoration.none),
),
),
TypingIndicator(
showIndicator: true,
flashingCircleBrightColor: ColorConstants.LIGHT_GREY,
flashingCircleDarkColor: ColorConstants.DARK_GREY,
),
],
);
}
// ignore: always_declare_return_types
hide() {
print('hide called');
if (_showing) {
NavService.navKey.currentState!.pop();
_showing = false;
}
}
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/common_components/triple_dot_loading.dart | import 'dart:math';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
class TypingIndicator extends StatefulWidget {
const TypingIndicator({
Key? key,
this.showIndicator = false,
this.flashingCircleDarkColor = const Color(0xFF333333),
this.flashingCircleBrightColor = const Color(0xFFaec1dd),
}) : super(key: key);
final bool showIndicator;
final Color flashingCircleDarkColor;
final Color flashingCircleBrightColor;
@override
_TypingIndicatorState createState() => _TypingIndicatorState();
}
class _TypingIndicatorState extends State<TypingIndicator>
with TickerProviderStateMixin {
AnimationController? _appearanceController;
late Animation<double> _indicatorSpaceAnimation;
late Animation<double> _largeBubbleAnimation;
late AnimationController _repeatingController;
final List<Interval> _dotIntervals = const [
Interval(0.25, 0.8),
Interval(0.35, 0.9),
Interval(0.45, 1.0),
];
@override
void initState() {
super.initState();
_appearanceController = AnimationController(
vsync: this,
)..addListener(() {
setState(() {});
});
_indicatorSpaceAnimation = CurvedAnimation(
parent: _appearanceController!,
curve: const Interval(0.0, 0.4, curve: Curves.easeOut),
reverseCurve: const Interval(0.0, 1.0, curve: Curves.easeOut),
).drive(Tween<double>(
begin: 0.0,
end: 60.0,
));
_largeBubbleAnimation = CurvedAnimation(
parent: _appearanceController!,
curve: const Interval(0.3, 1.0, curve: Curves.elasticOut),
reverseCurve: const Interval(0.5, 1.0, curve: Curves.easeOut),
);
_repeatingController = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 1500),
);
if (widget.showIndicator) {
_showIndicator();
}
}
@override
void didUpdateWidget(TypingIndicator oldWidget) {
super.didUpdateWidget(oldWidget);
if (widget.showIndicator != oldWidget.showIndicator) {
if (widget.showIndicator) {
_showIndicator();
} else {
_hideIndicator();
}
}
}
@override
void dispose() {
_appearanceController!.dispose();
_repeatingController.dispose();
super.dispose();
}
void _showIndicator() {
_appearanceController!
..duration = const Duration(milliseconds: 750)
..forward();
_repeatingController.repeat();
}
void _hideIndicator() {
_appearanceController!
..duration = const Duration(milliseconds: 150)
..reverse();
_repeatingController.stop();
}
@override
Widget build(BuildContext context) {
return AnimatedBuilder(
animation: _indicatorSpaceAnimation,
builder: (context, child) {
return SizedBox(
height: _indicatorSpaceAnimation.value,
child: child,
);
},
child: _buildAnimatedBubble(
animation: _largeBubbleAnimation,
left: 12,
bottom: 12,
bubble: _buildStatusBubble(),
),
);
}
Widget _buildAnimatedBubble({
required Animation<double> animation,
required double left,
required double bottom,
required Widget bubble,
}) {
return AnimatedBuilder(
animation: animation,
builder: (context, child) {
return Transform.scale(
scale: animation.value,
alignment: Alignment.bottomLeft,
child: child,
);
},
child: bubble,
);
}
Widget _buildStatusBubble() {
return Container(
width: 40,
height: 40,
padding: const EdgeInsets.symmetric(horizontal: 2),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
_buildFlashingCircle(0),
_buildFlashingCircle(1),
_buildFlashingCircle(2),
],
),
);
}
Widget _buildFlashingCircle(int index) {
return AnimatedBuilder(
animation: _repeatingController,
builder: (context, child) {
final circleFlashPercent =
_dotIntervals[index].transform(_repeatingController.value);
final circleColorPercent = sin(pi * circleFlashPercent);
return Container(
width: 5,
height: 5,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Color.lerp(widget.flashingCircleDarkColor,
widget.flashingCircleBrightColor, circleColorPercent),
),
);
},
);
}
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/common_components/custom_popup_route.dart | import 'package:flutter/material.dart';
class CustomPopupRoutes<T> extends PopupRoute<T> {
CustomPopupRoutes({
required RoutePageBuilder pageBuilder,
bool barrierDismissible = true,
String? barrierLabel,
Color barrierColor = const Color(0x80000000),
Duration transitionDuration = const Duration(milliseconds: 200),
RouteTransitionsBuilder? transitionBuilder,
RouteSettings? settings,
}) : _pageBuilder = pageBuilder,
_barrierDismissible = barrierDismissible,
_barrierLabel = barrierLabel,
_barrierColor = barrierColor,
_transitionDuration = transitionDuration,
_transitionBuilder = transitionBuilder,
super(settings: settings);
final RoutePageBuilder _pageBuilder;
@override
bool get barrierDismissible => _barrierDismissible;
final bool _barrierDismissible;
@override
String? get barrierLabel => _barrierLabel;
final String? _barrierLabel;
@override
Color get barrierColor => _barrierColor;
final Color _barrierColor;
@override
Duration get transitionDuration => _transitionDuration;
final Duration _transitionDuration;
final RouteTransitionsBuilder? _transitionBuilder;
@override
Widget buildPage(BuildContext context, Animation<double> animation,
Animation<double> secondaryAnimation) {
return Semantics(
scopesRoute: true,
explicitChildNodes: true,
child: _pageBuilder(context, animation, secondaryAnimation),
);
}
@override
Widget buildTransitions(BuildContext context, Animation<double> animation,
Animation<double> secondaryAnimation, Widget child) {
if (_transitionBuilder == null) {
return FadeTransition(
opacity: CurvedAnimation(
parent: animation,
curve: Curves.linear,
),
child: child);
} // Some default transition
return _transitionBuilder!(context, animation, secondaryAnimation, child);
}
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/common_components/end_animation.dart | import 'package:pizza_animation/services/size_config.dart';
import 'package:pizza_animation/utils/text_styles.dart';
import 'package:flutter/material.dart';
import 'package:lottie/lottie.dart';
class EndAnimation extends StatefulWidget {
const EndAnimation({
Key? key,
}) : super(key: key);
@override
_EndAnimationState createState() => _EndAnimationState();
}
class _EndAnimationState extends State<EndAnimation> {
bool showSuccess = false;
@override
void initState() {
super.initState();
Future.delayed(Duration(milliseconds: 2500), () {
setState(() {
showSuccess = true;
});
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: 300.toHeight,
width: 400.toWidth,
child: LottieBuilder.asset("assets/Processing.json"),
),
SizedBox(height: 10.toHeight),
if (!showSuccess)
Text(
"Processing...",
style: CustomTextStyles.commonMontserrat(size: 28),
),
if (showSuccess)
Text(
"Order Placed Successfully..",
style: CustomTextStyles.commonMontserrat(size: 22),
textAlign: TextAlign.center,
),
],
),
);
}
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/view_models/user_data_provider.dart | import 'package:pizza_animation/model/user_data.dart';
import 'package:pizza_animation/services/firestore_service.dart';
import 'package:flutter/material.dart';
class UserDataProvider extends ChangeNotifier {
UserDataProvider();
UserData? userData;
getUserDetails() async {
userData = await FirestoreService().getUserDetails();
}
// var _demoData = UserData(
// name: 'Avinash',
// phoneNumber: '9999999991',
// address: 'B/4');
// await _userDataProvider
// .setUserDetails(_demoData);
setUserDetails(UserData _userData) async {
var _result = await FirestoreService().setUserDetails(_userData);
if (_result) {
userData = _userData;
}
}
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/view_models/ingridients_view_model.dart | import 'package:pizza_animation/screens/diy_pizza_screen.dart';
import 'package:flutter/material.dart';
class IngridientsViewModel extends ChangeNotifier {
List<Ingridients> ingridients = [];
addIngridient(Ingridients ingridient) {
if (ingridients.indexOf(ingridient) == -1) {
ingridients.add(ingridient);
notifyListeners();
}
}
removeIngridient(int index) {
ingridients.removeAt(index);
notifyListeners();
}
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/view_models/pizza_view_model.dart | import 'dart:async';
import 'dart:typed_data';
import 'package:pizza_animation/utils/constants.dart';
import 'package:flutter/material.dart';
class PizzaViewModel extends ChangeNotifier {
double pizzaPrice = 189;
Map<String, dynamic> selectedPizzaObj = {};
late AnimationController pizzaAnimationController;
late Animation<double> pizzaXVal;
late bool scaleAnimateForward = false;
late bool scaleAnimateReverse = false;
late Uint8List pizzaImage;
SauceType sauceType = SauceType.Plain;
incPizzaPrice() {
pizzaPrice++;
notifyListeners();
}
decPizzaPrice() {
pizzaPrice--;
notifyListeners();
}
setSauceType(SauceType type) {
sauceType = type;
notifyListeners();
}
getSauceType() {
if (sauceType == SauceType.Plain)
return Constants.BREADS[0];
else if (sauceType == SauceType.PepperyRed)
return Constants.BREADS[2];
else if (sauceType == SauceType.TraditionalTomato)
return Constants.BREADS[1];
else if (sauceType == SauceType.SpicyRed)
return Constants.BREADS[3];
else if (sauceType == SauceType.None) return Constants.BREADS[4];
}
animateForward() {
scaleAnimateForward = true;
notifyListeners();
Timer(Duration(milliseconds: 500), () {
scaleAnimateForward = false;
});
}
animateRev() {
scaleAnimateReverse = true;
notifyListeners();
Timer(Duration(milliseconds: 500), () {
scaleAnimateReverse = false;
});
}
}
enum SauceType {
Plain,
PepperyRed,
TraditionalTomato,
SpicyRed,
None,
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/utils/images.dart | class ImageAssets {
static const SPLASH_BG = 'assets/illustrations/splash_back.png';
static const USER_FORM_IMAGE = 'assets/illustrations/mobile-phone.png';
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/utils/text_styles.dart | import 'package:pizza_animation/services/size_config.dart';
import 'package:pizza_animation/utils/colors.dart';
import 'package:flutter/material.dart';
class CustomTextStyles {
static TextStyle commonMontserrat({
double size = 17,
Color? color = Colors.black,
FontWeight? fontWeight = FontWeight.w600,
}) =>
TextStyle(
fontFamily: 'Montserrat',
fontSize: size.toFont,
fontWeight: fontWeight,
color: color,
);
static TextStyle changeAddress({double size = 15}) => TextStyle(
fontSize: size,
color: Colors.grey[500],
fontFamily: "Montserrat",
);
static TextStyle delivery({double size = 22}) => TextStyle(
fontSize: size.toFont,
fontWeight: FontWeight.w800,
fontFamily: "Montserrat",
);
static TextStyle orderPizza({double size = 30}) => TextStyle(
fontFamily: "AllertaStencil",
fontSize: size,
color: ColorConstants.Blue_Gray,
// fontWeight: FontWeight.w700,
);
static TextStyle pizza({int size = 40}) => TextStyle(
fontFamily: "AllertaStencil",
fontSize: 20,
color: ColorConstants.white,
// fontWeight: FontWeight.w700,
);
static TextStyle pizzaName({int size = 40}) => TextStyle(
fontFamily: "AllertaStencil",
fontSize: 30,
color: ColorConstants.Blue_Gray,
// fontWeight: FontWeight.w700,
);
static TextStyle priceStyle({int size = 40}) => TextStyle(
color: ColorConstants.Blue_Gray,
fontSize: size.toFont,
letterSpacing: 3,
fontWeight: FontWeight.bold,
fontFamily: "AbrilFatface",
);
static TextStyle pizzaSauceTextStyle({
int size = 16,
color: Colors.brown,
}) =>
TextStyle(
color: color,
fontSize: size.toFont,
letterSpacing: 0.1,
fontWeight: FontWeight.bold,
);
static TextStyle buyNowTextStyle({int size = 16}) => TextStyle(
color: ColorConstants.white,
fontSize: size.toFont,
letterSpacing: 0.1,
fontWeight: FontWeight.bold,
);
static TextStyle chooseSauceTypeTextStyle({int size = 16}) => TextStyle(
color: ColorConstants.black,
fontSize: size.toFont,
letterSpacing: 0.1,
fontWeight: FontWeight.bold,
);
static TextStyle white({int size = 16}) => TextStyle(
color: ColorConstants.white,
fontSize: size.toFont,
letterSpacing: 0.1,
fontWeight: FontWeight.normal);
static TextStyle whiteBold({int size = 16}) => TextStyle(
color: ColorConstants.white,
fontSize: size.toFont,
letterSpacing: 0.1,
fontWeight: FontWeight.bold);
static TextStyle black({int size = 16}) => TextStyle(
color: ColorConstants.black,
fontSize: size.toFont,
letterSpacing: 0.1,
fontWeight: FontWeight.normal);
static TextStyle blackBold({int size = 16}) => TextStyle(
color: ColorConstants.black,
fontSize: size.toFont,
letterSpacing: 0.1,
fontWeight: FontWeight.bold);
static TextStyle customTextStyle(Color color, {int size = 16}) => TextStyle(
color: color,
fontSize: size.toFont,
letterSpacing: 0.1,
fontWeight: FontWeight.normal);
static TextStyle customBoldTextStyle(Color color, {int size = 16}) =>
TextStyle(
color: color,
fontSize: size.toFont,
letterSpacing: 0.1,
fontWeight: FontWeight.bold);
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/utils/constants.dart | import 'package:pizza_animation/models/card_model.dart';
import 'package:flutter/material.dart';
class Constants {
static const double PIZZAPADDING = 40;
static const double HEADERHEIGHT = 200;
static const PIZZA_SLICE_ANIMATION = 'assets/splash/Pizza.json';
static const PIZZA_CUTTER = 'assets/wheel-knife.png';
static const PIZZA_ICON = 'assets/chef.png';
static const PIZZA_PLATE = 'assets/Plate.png';
static const HOME_BANNER_ANIMATION = 'assets/lottie_files/pizza-P.json';
static const List<String> PIZZAS = [
'assets/Pizzas/Pizza_1.png',
'assets/Pizzas/Pizza_2.png',
'assets/Pizzas/Pizza_3.png',
'assets/Pizzas/Pizza_4.png',
'assets/Pizzas/Pizza_5.png',
];
static const List<String> BREADS = [
'assets/Bread/Bread_1.png',
'assets/Bread/Bread_2.png',
'assets/Bread/Bread_3.png',
'assets/Bread/Bread_4.png',
'assets/Bread/Bread_5.png',
];
static const List<String> BASIL = [
'assets/Basil/Basil_1.png',
'assets/Basil/Basil_2.png',
'assets/Basil/Basil_3.png',
'assets/Basil/Basil_4.png',
'assets/Basil/Basil_5.png',
'assets/Basil/Basil_6.png',
'assets/Basil/Basil_7.png',
'assets/Basil/Basil_8.png',
'assets/Basil/Basil_9.png',
'assets/Basil/Basil_10.png',
'assets/Basil/Basil_11.png',
];
static const List<String> BROCCOLI = [
'assets/Broccoli/Broccoli_1.png',
'assets/Broccoli/Broccoli_2.png',
'assets/Broccoli/Broccoli_3.png',
'assets/Broccoli/Broccoli_4.png',
'assets/Broccoli/Broccoli_5.png',
'assets/Broccoli/Broccoli_6.png',
'assets/Broccoli/Broccoli_7.png',
'assets/Broccoli/Broccoli_8.png',
'assets/Broccoli/Broccoli_9.png',
'assets/Broccoli/Broccoli_10.png',
'assets/Broccoli/Broccoli_11.png',
];
static const List<String> MASHROOM = [
'assets/Mushroom/Mushroom_1.png',
'assets/Mushroom/Mushroom_2.png',
'assets/Mushroom/Mushroom_3.png',
'assets/Mushroom/Mushroom_4.png',
'assets/Mushroom/Mushroom_5.png',
'assets/Mushroom/Mushroom_6.png',
'assets/Mushroom/Mushroom_7.png',
'assets/Mushroom/Mushroom_8.png',
'assets/Mushroom/Mushroom_9.png',
'assets/Mushroom/Mushroom_10.png',
'assets/Mushroom/Mushroom_11.png',
'assets/Mushroom/Mushroom_12.png',
];
static const List<String> ONION = [
'assets/Onion/Onion_1.png',
'assets/Onion/Onion_2.png',
'assets/Onion/Onion_3.png',
'assets/Onion/Onion_4.png',
'assets/Onion/Onion_5.png',
'assets/Onion/Onion_6.png',
'assets/Onion/Onion_7.png',
'assets/Onion/Onion_8.png',
'assets/Onion/Onion_9.png',
'assets/Onion/Onion_10.png',
'assets/Onion/Onion_11.png',
'assets/Onion/Onion_12.png',
'assets/Onion/Onion_13.png',
];
static const List<String> SAUSAGE = [
'assets/Sausage/Sausage_1.png',
'assets/Sausage/Sausage_2.png',
'assets/Sausage/Sausage_3.png',
'assets/Sausage/Sausage_4.png',
'assets/Sausage/Sausage_5.png',
'assets/Sausage/Sausage_6.png',
'assets/Sausage/Sausage_7.png',
'assets/Sausage/Sausage_8.png',
'assets/Sausage/Sausage_9.png',
'assets/Sausage/Sausage_10.png',
'assets/Sausage/Sausage_11.png',
'assets/Sausage/Sausage_12.png',
'assets/Sausage/Sausage_13.png',
'assets/Sausage/Sausage_14.png',
'assets/Sausage/Sausage_15.png',
'assets/Sausage/Sausage_16.png',
'assets/Sausage/Sausage_17.png',
'assets/Sausage/Sausage_18.png',
'assets/Sausage/Sausage_19.png',
'assets/Sausage/Sausage_20.png',
'assets/Sausage/Sausage_21.png',
'assets/Sausage/Sausage_22.png',
'assets/Sausage/Sausage_23.png',
'assets/Sausage/Sausage_24.png',
];
static const List<Map<String, dynamic>> EXTRA = [
{"path": 'assets/Extra/GreenSweetPepper.png', "size": 40.0},
{"path": 'assets/Sausage/Sausage_2.png', "size": 35.0},
{"path": 'assets/Extra/Red_Bell_Pepper_Chop.png', "size": 42.0},
{"path": 'assets/Extra/Red_Bell_Pepper_Sliced.png', "size": 38.0},
{"path": 'assets/Extra/Thyme_branch.png', "size": 60.0},
{"path": 'assets/Mushroom/Mushroom_5.png', "size": 60.0},
{"path": 'assets/Basil/Basil_7.png', "size": 45.0},
{"path": 'assets/Broccoli/Broccoli_1.png', "size": 41.0},
{"path": 'assets/Onion/Onion_2.png', "size": 42.0},
{"path": 'assets/Mushroom/Mushroom_6.png', "size": 60.0},
{"path": 'assets/Basil/Basil_8.png', "size": 30.0},
];
static List<Map<String, dynamic>> pizzaList = [
{
"name": "Tomato Pizza",
"rating": 4,
"price": "539",
"path": Constants.PIZZAS[0],
},
{
"name": "Pepperoni Pizza",
"rating": 3,
"price": "459",
"path": Constants.PIZZAS[1],
},
{
"name": "Pineapple Pizza",
"rating": 2,
"price": "719",
"path": Constants.PIZZAS[2],
},
{
"name": "Veg. Pizza",
"rating": 4,
"price": "339",
"path": Constants.PIZZAS[3],
},
{
"name": "Cheeze Burst",
"rating": 5,
"price": "839",
"path": Constants.PIZZAS[4],
}
];
static const double cardContainerHeightBegin = 250;
static const double cardContainerHeightEnd = 500;
static List<CardModel> cardModel = [
CardModel(
title: "Executive Card",
amount: 1159,
borderContainer1: [
const Color(0xFF161215),
const Color(0xFF615c61),
const Color(0xFF403c40),
],
borderContainer2: [
const Color(0xFF161215).withOpacity(0.7),
const Color(0xFF4a474a).withOpacity(0.1),
],
bottomContainer: [
const Color(0xFF161215),
const Color(0xFF4a474a),
const Color(0xFF4a474a),
],
topCurveContainer: [
const Color(0xFF1f191d),
const Color(0xFF595659),
],
pizzaBgImage: "assets/teamwork.png",
),
CardModel(
title: "Food Card",
amount: 1129,
borderContainer1: [
const Color(0xFFC26C2C),
const Color(0xFFf5b87a),
const Color(0xFFf2a250),
],
borderContainer2: [
const Color(0xFFC26C2C).withOpacity(0.7),
const Color(0xFFC26C2C).withOpacity(0.1),
],
bottomContainer: [
const Color(0xFFC26C2C),
const Color(0xFFe09241),
const Color(0xFFECA760),
],
topCurveContainer: [
const Color(0xFFc47131),
const Color(0xFFeba663),
],
pizzaBgImage: "assets/pizza-slice.png",
),
CardModel(
title: "Gift Card",
amount: 1179,
borderContainer1: [
const Color(0xFF181442),
const Color(0xFF595394),
const Color(0xFF433E7C),
],
borderContainer2: [
const Color(0xFF181442).withOpacity(0.9),
const Color(0xFF2E2960).withOpacity(0.1),
],
bottomContainer: [
const Color(0xFF181442),
const Color(0xFF3E3976),
const Color(0xFF433E7C),
],
topCurveContainer: [
const Color(0xFF1d1a47),
const Color(0xFF433E7C),
],
pizzaBgImage: "assets/gift.png",
),
];
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/utils/colors.dart | import 'package:flutter/material.dart';
class ColorConstants {
static const Color orange = Color(0xFFF2623E);
static const Color white = Colors.white;
// static const Color black = Colors.black;
static const Color blackShade2 = Color(0xFF14141C);
static const Color black = Color(0xFF121212);
static const Color red = Color(0xFFED4D3C);
static const darkBlue = Color(0xFF0D1F44);
static const purple = Color(0xFF58419C);
static const amber = Colors.amber;
static const Blue_Gray = Colors.blueGrey;
static const peach = Color(0xFF6EBCB7);
static const blue = Color(0xFF0455BF);
static const solidPink = Color(0xFFFE1094);
static const fadedBrown = Color(0xFFA77D60);
static const solidOrange = Color(0xFFEF5743);
static const solidLightGreen = Color(0xFF7CCB12);
static const solidYellow = Color(0xFFFFBE21);
/// Purple Shades
static const purpleShade1 = Color(0xFFF5F4F9);
static const purpleShade2 = Color(0xFF58419C);
static const peachShade1 = Color(0xFFF4F5F7);
static const peachShade2 = Color(0xFF0E3334);
static const Color lightPurple = Color(0XFFF5F4F9);
static const Color lightPurpleText = Color(0xFF9789C2);
static const Color lightGrey = Color(0xFFF5F4F9);
static const Color greyText = Color(0xFF98A0B1);
static const Color primary = Color(0xFF98A0B1);
/// Opacity color
static Color dullColor({Color color = Colors.black, double opacity = 0.5}) =>
color.withOpacity(opacity);
/// grey shades
static const Color LIGHT_GREY = Color(0xFFBEC0C8);
static const Color DARK_GREY = Color(0xFF6D6D79);
static const Color MILD_GREY = Color(0xFFE4E4E4);
static const Color RED = Color(0xFFe34040);
}
class ContactInitialsColors {
static Color getColor(String atsign) {
switch (atsign[1].toUpperCase()) {
case 'A':
return Color(0xFFAA0DFE);
case 'B':
return Color(0xFF3283FE);
case 'C':
return Color(0xFF85660D);
case 'D':
return Color(0xFF782AB6);
case 'E':
return Color(0xFF565656);
case 'F':
return Color(0xFF1C8356);
case 'G':
return Color(0xFF16FF32);
case 'H':
return Color(0xFFF7E1A0);
case 'I':
return Color(0xFFE2E2E2);
case 'J':
return Color(0xFF1CBE4F);
case 'K':
return Color(0xFFC4451C);
case 'L':
return Color(0xFFDEA0FD);
case 'M':
return Color(0xFFFE00FA);
case 'N':
return Color(0xFF325A9B);
case 'O':
return Color(0xFFFEAF16);
case 'P':
return Color(0xFFF8A19F);
case 'Q':
return Color(0xFF90AD1C);
case 'R':
return Color(0xFFF6222E);
case 'S':
return Color(0xFF1CFFCE);
case 'T':
return Color(0xFF2ED9FF);
case 'U':
return Color(0xFFB10DA1);
case 'V':
return Color(0xFFC075A6);
case 'W':
return Color(0xFFFC1CBF);
case 'X':
return Color(0xFFB00068);
case 'Y':
return Color(0xFFFBE426);
case 'Z':
return Color(0xFFFA0087);
case '@':
return Color(0xFFAA0DFE);
default:
return Color(0xFFAA0DFE);
}
}
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/animation/pizza_box.dart | import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
class PizzaBox extends StatefulWidget {
@override
State<PizzaBox> createState() => _PizzaBoxState();
}
class _PizzaBoxState extends State<PizzaBox>
with SingleTickerProviderStateMixin {
Duration movingPizzaDuration = const Duration(milliseconds: 500);
double _left = 20;
double _top = 20;
bool _isAtCenter = true;
double _fixedCenterPizzaDiameter =
300; // usedfor calculation as [_circleDiameter] will vary
double _circleDiameter = 300;
//////////
late AnimationController _centerPizzaController;
var _centerPizzaTransform = Tween<double>(
begin: 0,
end: 300,
);
late Animation<double> _centerPizzaAnimation;
@override
void initState() {
_centerPizzaController =
AnimationController(vsync: this, duration: movingPizzaDuration);
_centerPizzaAnimation = _centerPizzaTransform.animate(
CurvedAnimation(parent: _centerPizzaController, curve: Curves.easeOut));
super.initState();
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
moveToCenter();
});
}
moveToCart() async {
setState(() {
_left = MediaQuery.of(context).size.width -
50 -
30; // 50 size of small pizza at cart, 30 padding
_top = 50; // position of cart
_circleDiameter = 50;
});
// await Future.delayed(movingPizzaDuration);
_centerPizzaController.forward();
}
moveToCenter() async {
setState(() {
_left = MediaQuery.of(context).size.width / 2 -
(_fixedCenterPizzaDiameter / 2);
_top = MediaQuery.of(context).size.height / 2 -
(_fixedCenterPizzaDiameter / 2);
_circleDiameter = 300;
});
// await Future.delayed(movingPizzaDuration);
_centerPizzaController.reverse();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: <Widget>[movingPizzaWidget(), centerPizzaWidget()],
),
);
}
Widget movingPizzaWidget() {
return AnimatedPositioned(
duration: movingPizzaDuration,
curve: Curves.fastOutSlowIn,
left: _left,
top: _top,
width: _circleDiameter,
height: _circleDiameter,
child: InkWell(
onTap: () {
if (_isAtCenter) {
moveToCart();
} else {
moveToCenter();
}
_isAtCenter = !_isAtCenter;
},
child: Container(
child: Image.asset('assets/Bread/Bread_1.png'),
),
),
);
}
Widget centerPizzaWidget() {
return AnimatedBuilder(
animation: _centerPizzaController,
builder: (content, _) {
return Positioned(
top: MediaQuery.of(context).size.height / 2 -
(_centerPizzaAnimation.value / 2),
left: MediaQuery.of(context).size.width / 2 -
(_centerPizzaAnimation.value / 2),
child: Container(
width: _centerPizzaAnimation.value,
height: _centerPizzaAnimation.value,
child: Image.asset('assets/Bread/Bread_1.png'),
),
);
},
);
}
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/services/firestore_service.dart | import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:pizza_animation/model/user_data.dart';
import 'package:pizza_animation/services/firebase_service.dart';
class FirestoreService {
FirestoreService._();
static FirestoreService _instance = FirestoreService._();
factory FirestoreService() => _instance;
CollectionReference usersCollection =
FirebaseFirestore.instance.collection('userData');
final usersRef =
FirebaseFirestore.instance.collection('userData').withConverter<UserData>(
fromFirestore: (snapshot, _) => UserData.fromJson(snapshot.data()!),
toFirestore: (movie, _) => movie.toJson(),
);
Future<UserData?> getUserDetails() async {
if (FirebaseService().firebaseAuth.currentUser == null) {
return null;
}
print('uid ${FirebaseService().firebaseAuth.currentUser!.uid}');
UserData? _userData = await usersRef
.doc(FirebaseService().firebaseAuth.currentUser!.uid)
.get()
.then((snapshot) => snapshot.data());
print('getUserDetails() ========> _userData: $_userData');
return _userData;
}
Future<bool> setUserDetails(UserData _userData) {
return usersRef
.doc(FirebaseService().firebaseAuth.currentUser!.uid)
.set(_userData)
.then((value) => true)
.catchError((error) {
print("Failed to add user: $error");
return false;
});
}
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/services/size_config.dart | import 'package:flutter/material.dart';
class SizeConfig {
SizeConfig._();
static SizeConfig _instance = SizeConfig._();
factory SizeConfig() => _instance;
late MediaQueryData _mediaQueryData;
late double screenWidth;
late double screenHeight;
late double blockSizeHorizontal;
late double blockSizeVertical;
late double deviceTextFactor;
late double _safeAreaHorizontal;
late double _safeAreaVertical;
late double safeBlockHorizontal;
late double safeBlockVertical;
late double profileDrawerWidth;
late double refHeight;
late double refWidth;
late double textFactor = 1.0;
// bool isDesktop = false;
bool isMobile(BuildContext context) =>
MediaQuery.of(context).size.width < 700;
bool isTablet(BuildContext context) =>
MediaQuery.of(context).size.width >= 700 &&
MediaQuery.of(context).size.width < 1200;
bool isDesktop(BuildContext context) =>
MediaQuery.of(context).size.width >= 1200;
void init(BuildContext context) {
_mediaQueryData = MediaQuery.of(context);
screenWidth = _mediaQueryData.size.width;
screenHeight = _mediaQueryData.size.height;
refHeight = 812;
refWidth = 375;
deviceTextFactor = _mediaQueryData.textScaleFactor;
if (screenHeight < 1200) {
blockSizeHorizontal = screenWidth / 100;
blockSizeVertical = screenHeight / 100;
_safeAreaHorizontal =
_mediaQueryData.padding.left + _mediaQueryData.padding.right;
_safeAreaVertical =
_mediaQueryData.padding.top + _mediaQueryData.padding.bottom;
safeBlockHorizontal = (screenWidth - _safeAreaHorizontal) / 100;
safeBlockVertical = (screenHeight - _safeAreaVertical) / 100;
} else {
blockSizeHorizontal = screenWidth / 120;
blockSizeVertical = screenHeight / 120;
_safeAreaHorizontal =
_mediaQueryData.padding.left + _mediaQueryData.padding.right;
_safeAreaVertical =
_mediaQueryData.padding.top + _mediaQueryData.padding.bottom;
safeBlockHorizontal = (screenWidth - _safeAreaHorizontal) / 120;
safeBlockVertical = (screenHeight - _safeAreaVertical) / 120;
}
if (screenWidth > 700) {
textFactor = 0.8;
}
}
double getWidthRatio(double val) {
double res = (val / refWidth) * 100;
double temp = res * blockSizeHorizontal;
return temp;
}
double getHeightRatio(double val) {
double res = (val / refHeight) * 100;
double temp = res * blockSizeVertical;
return temp;
}
double getFontRatio(double val) {
double res = (val / refWidth) * 100;
double temp = 0.0;
if (screenWidth < screenHeight) {
temp = res * safeBlockHorizontal * textFactor;
} else {
temp = res * safeBlockVertical * textFactor;
}
// print('$val,$temp,$refHeight,$refWidth');
return temp;
}
}
extension SizeUtils on num {
double get toWidth => SizeConfig().getWidthRatio(this.toDouble());
double get toHeight => SizeConfig().getHeightRatio(this.toDouble());
double get toFont => SizeConfig().getFontRatio(this.toDouble());
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/services/nav_service.dart | import 'package:flutter/material.dart';
class NavService {
static GlobalKey<NavigatorState> navKey = GlobalKey();
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/services/firebase_service.dart | import 'package:firebase_auth/firebase_auth.dart';
// import 'package:provider/provider.dart';
// import 'package:pizza_animation/routes/route_names.dart';
// import 'package:pizza_animation/routes/routes.dart';
// import 'package:pizza_animation/services/nav_service.dart';
class FirebaseService {
FirebaseService._();
static FirebaseService _instance = FirebaseService._();
factory FirebaseService() => _instance;
final FirebaseAuth firebaseAuth = FirebaseAuth.instance;
late String _verificationId;
checkState() {
if ((firebaseAuth.currentUser != null) &&
(firebaseAuth.currentUser?.getIdToken() != null)) {
return true;
}
return false;
}
signOut() {
firebaseAuth.signOut();
// Provider.of<UserProvider>(NavService.navKey.currentContext, listen: false)
// .resetUserProvider();
// Provider.of<ChallengesProvider>(NavService.navKey.currentContext,
// listen: false)
// .resetChallengeProvider();
// SetupRoutes.pushAndRemoveAll(
// NavService.navKey.currentContext, Routes.SPLASH);
}
verifyPhoneNumber(String phoneNumber) async {
bool? _result;
await FirebaseAuth.instance.verifyPhoneNumber(
phoneNumber: '+91 $phoneNumber',
verificationCompleted: (PhoneAuthCredential credential) async {},
verificationFailed: (FirebaseAuthException e) {
print('verificationFailed $e');
_result = false;
},
codeSent: (String verificationId, int? resendToken) async {
_verificationId = verificationId;
_result = true;
},
codeAutoRetrievalTimeout: (String verificationId) {},
);
/// wait until we have a result
while (_result == null) {
await Future.delayed(Duration(seconds: 2));
}
return _result;
}
verifyOTP(String otp) async {
PhoneAuthCredential credential = PhoneAuthProvider.credential(
verificationId: _verificationId, smsCode: otp);
var _result = await firebaseAuth
.signInWithCredential(credential)
.then((newUser) async {
return newUser.user;
}).catchError((e) => print('$e'));
return _result;
}
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/screens/checkout_screen.dart | import 'dart:async';
import 'package:pizza_animation/common_components/end_animation.dart';
import 'package:pizza_animation/components/card_details.dart';
import 'package:pizza_animation/components/cards_container.dart';
import 'package:pizza_animation/components/topbar.dart';
import 'package:pizza_animation/routes/route_names.dart';
import 'package:pizza_animation/utils/constants.dart';
import 'package:pizza_animation/view_models/ingridients_view_model.dart';
import 'package:pizza_animation/view_models/pizza_view_model.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class CheckoutPage extends StatefulWidget {
CheckoutPage({Key? key}) : super(key: key);
@override
_CheckoutPageState createState() => _CheckoutPageState();
}
class _CheckoutPageState extends State<CheckoutPage>
with TickerProviderStateMixin {
late AnimationController animationController;
late Animation<dynamic> containerHeightAnimation;
late Animation<dynamic> cardHeightAnimation;
late Animation<dynamic> cardXAnimation;
late Animation<double> cardSize;
late Animation<double> cardTransform;
late Animation<double> spendContainerOpacity;
bool showEndLottie = false;
int? selectedCard;
@override
void initState() {
super.initState();
animationController = AnimationController(
vsync: this,
duration: Duration(milliseconds: 600),
);
containerHeightAnimation = Tween(
begin: Constants.cardContainerHeightBegin,
end: Constants.cardContainerHeightEnd,
).animate(
CurvedAnimation(
parent: animationController,
curve: Curves.easeOutQuad,
reverseCurve: Interval(0.0, 0.5, curve: Curves.easeIn),
),
);
cardHeightAnimation = Tween(
begin: 0.0,
end: 0.5,
).animate(
CurvedAnimation(
parent: animationController,
curve: Interval(0, 0.2, curve: Curves.easeInOutQuint),
reverseCurve: Interval(0.9, 1.0, curve: Curves.fastLinearToSlowEaseIn),
),
);
cardXAnimation = Tween(begin: 0.00, end: 0.42).animate(
CurvedAnimation(
parent: animationController,
curve: Curves.easeIn,
reverseCurve: Curves.easeIn,
),
);
cardSize = Tween(begin: 0.95, end: 1.0).animate(
CurvedAnimation(
parent: animationController,
curve: Curves.easeInExpo,
),
);
cardTransform = Tween<double>(begin: 0, end: 0.1).animate(CurvedAnimation(
parent: animationController,
curve: Interval(0.0, 0.2, curve: Curves.easeIn),
reverseCurve: Interval(0.95, 1, curve: Curves.easeOut),
));
spendContainerOpacity = Tween(begin: 1.0, end: 0.0).animate(
CurvedAnimation(
parent: animationController,
curve: Curves.easeIn,
),
);
}
void updateIsDetailOpen(bool value, int? index) {
setState(() {
selectedCard = index;
});
}
@override
Widget build(BuildContext context) {
return showEndLottie
? EndAnimation()
: Scaffold(
backgroundColor: Colors.grey[100],
body: SafeArea(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
TopBar(
selectedCard: selectedCard,
),
CardsContainer(
animationController: animationController,
containerHeightAnimation: containerHeightAnimation,
cardXAnimation: cardXAnimation,
cardSize: cardSize,
cardTransform: cardTransform,
cardHeightAnimation: cardHeightAnimation,
updateIsDetailOpen: updateIsDetailOpen,
),
CardDetails(
spendContainerOpacity: spendContainerOpacity,
onPayNow: () {
setState(() {
showEndLottie = true;
});
Timer(Duration(seconds: 4), () {
Navigator.popAndPushNamed(context, Routes.HOME);
});
Provider.of<PizzaViewModel>(context, listen: false)
.selectedPizzaObj = {};
Provider.of<IngridientsViewModel>(context, listen: false)
.ingridients = [];
},
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/screens/home_screen.dart | import 'dart:math' as math;
import 'package:firebase_auth/firebase_auth.dart';
import 'package:pizza_animation/routes/route_names.dart';
import 'package:pizza_animation/routes/routes.dart';
import 'package:pizza_animation/services/firebase_service.dart';
import 'package:pizza_animation/services/size_config.dart';
import 'package:pizza_animation/utils/colors.dart';
import 'package:pizza_animation/utils/constants.dart';
import 'package:pizza_animation/utils/text_styles.dart';
import 'package:pizza_animation/view_models/pizza_view_model.dart';
import 'package:flutter/material.dart';
import 'package:lottie/lottie.dart';
import 'package:provider/provider.dart';
class Home extends StatefulWidget {
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State<Home> {
var pizzaOptions = Constants.pizzaList;
String searchText = '';
@override
Widget build(BuildContext context) {
SizeConfig().init(context);
return Scaffold(
backgroundColor: Colors.white,
body: SafeArea(
child: Container(
padding: const EdgeInsets.only(left: 10, right: 10, top: 20),
child: SingleChildScrollView(
child: Stack(children: [
Column(
children: <Widget>[
// Center(
// child: Text(
// 'Pizza',
// style: CustomTextStyles.blackBold(size: 25),
// ),
// ),
// const SizedBox(height: 20),
Container(
width: 300.toWidth,
padding: const EdgeInsets.symmetric(horizontal: 10),
decoration: BoxDecoration(
color: const Color(0xFFF7F7FF),
borderRadius: BorderRadius.circular(15),
),
child: Center(
child: Row(
children: <Widget>[
const Icon(Icons.search_outlined),
Expanded(
child: Container(
width: 200.toWidth,
padding: const EdgeInsets.only(left: 10),
child: TextFormField(
onChanged: (String str) {
setState(() {
searchText = str;
});
},
decoration: const InputDecoration(
hintText: 'Search',
hintStyle:
TextStyle(fontFamily: 'Montserrat'),
border: InputBorder.none),
),
),
),
IconButton(
icon: const Icon(Icons.logout_outlined),
onPressed: () {
FirebaseAuth.instance.signOut();
},
)
],
),
),
),
const SizedBox(height: 20),
// Container(
// decoration: BoxDecoration(
// // color: Color(0xFFFFC700),
// color: Colors.white,
// borderRadius: BorderRadius.all(
// Radius.circular(20.toWidth),
// ),
// ),
// child: ClipRRect(
// clipBehavior: Clip.hardEdge,
// child: Transform.scale(
// scale: 0.9,
// child: Lottie.asset(Constants.HOME_BANNER_ANIMATION)),
// ),
// ),
// const SizedBox(height: 20),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 18),
child: Row(
children: [
Expanded(
flex: 2,
child: GestureDetector(
onTap: () {
Navigator.pushNamed(
context, Routes.PIZZASELECTION);
},
child: Container(
padding: const EdgeInsets.only(right: 10),
height: 100.toHeight,
decoration: BoxDecoration(
color: const Color(0xFFF7F7FF),
borderRadius: BorderRadius.circular(10),
border: Border.all(
width: 2,
// color: const Color(0xFFFFC700),
color: Colors.blueGrey),
),
child: Stack(
children: [
Positioned(
left: -20,
// child: Transform.rotate(
// angle: -math.pi / 6,
child: Image.asset(
Constants.PIZZA_ICON,
height: 100,
),
// ),
),
Align(
alignment: Alignment.centerRight,
child: Text(
"Customize\nPizza",
style: CustomTextStyles.commonMontserrat(
size: 18,
),
textAlign: TextAlign.right,
),
),
],
),
),
),
),
const SizedBox(width: 10),
Expanded(
flex: 2,
child: GestureDetector(
onTap: () {
Navigator.pushNamed(context, Routes.DIYPIZZA);
},
child: Container(
padding: const EdgeInsets.only(left: 10),
height: 100.toHeight,
width: double.infinity,
decoration: BoxDecoration(
// color: const Color(0xFFFFC700),
color: Colors.blueGrey,
borderRadius: BorderRadius.circular(10),
),
// alignment: Alignment.centerLeft,
child: Stack(
children: [
Positioned(
right: -20,
child: Image.asset(
Constants.PIZZA_CUTTER,
height: 100,
),
),
Align(
alignment: Alignment.centerLeft,
child: Text(
"Build\nPizza",
style: CustomTextStyles.commonMontserrat(
size: 28,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
),
],
),
),
),
),
],
),
),
const SizedBox(height: 20),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: Align(
alignment: Alignment.centerLeft,
child: Text('Hungry ? Quick order',
style: CustomTextStyles.commonMontserrat(size: 18),
textAlign: TextAlign.left),
),
),
const SizedBox(height: 20),
Padding(
padding: const EdgeInsets.only(bottom: 100.0),
child: Wrap(
alignment: WrapAlignment.start,
runAlignment: WrapAlignment.start,
runSpacing: 15.0,
spacing: 20.0,
children: List.generate(pizzaOptions.length, (index) {
String pizzaName =
pizzaOptions[index]['name'] as String;
pizzaName = pizzaName.toLowerCase();
if (pizzaName
.contains(searchText.toLowerCase().trim())) {
return InkWell(
onTap: () {
final pizzaViewModel =
Provider.of<PizzaViewModel>(context,
listen: false);
pizzaViewModel.selectedPizzaObj =
pizzaOptions[index];
SetupRoutes.push(context, Routes.DIYPIZZA);
},
child: pizzaCard(
pizzaOptions[index]['path'] as String,
pizzaOptions[index]['name'] as String,
pizzaOptions[index]['price'] as String,
index == 0 || index == 1 ? true : false,
),
);
} else
return const SizedBox();
})),
),
],
),
]),
),
),
),
);
}
Widget pizzaCard(
String pizzaImage,
String title,
String price,
bool showTrending,
) {
return Stack(
children: [
Container(
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.13),
spreadRadius: 2,
blurRadius: 7,
offset: const Offset(0, 3),
),
],
borderRadius: const BorderRadius.all(
const Radius.circular(26),
),
),
child: Padding(
padding: const EdgeInsets.only(top: 8.0, right: 8, left: 8),
child: Column(
children: <Widget>[
Stack(
children: [
Container(
height: 150,
padding: const EdgeInsets.all(9),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(70),
),
child: Image.asset(Constants.PIZZA_PLATE),
),
Container(
height: 150,
padding: const EdgeInsets.all(15),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(70),
),
child: Image.asset(pizzaImage),
),
],
),
Text(
title,
style: TextStyle(
color: Colors.black.withOpacity(0.8),
fontSize: 16,
fontFamily: 'Montserrat',
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 5),
RichText(
text: TextSpan(
children: <TextSpan>[
const TextSpan(
text: "\₹ ",
style: const TextStyle(
color: Colors.red,
fontSize: 14,
fontFamily: 'Montserrat',
fontWeight: FontWeight.bold,
),
),
TextSpan(
text: "$price.00",
style: const TextStyle(
color: Colors.black,
fontSize: 16,
fontFamily: 'Montserrat',
fontWeight: FontWeight.bold,
),
),
],
)),
const SizedBox(height: 10),
],
),
),
),
if (showTrending)
Positioned(
right: 8,
top: 5,
child: Container(
padding: const EdgeInsets.all(5),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.redAccent.withOpacity(0.3),
),
child: const Text(
"🔥",
style: TextStyle(fontSize: 18),
),
),
)
],
);
}
/// if [isCustomBuild] is true button and text colors are inverted
Widget customButton(String text, {bool isCustomBuild: false}) {
return InkWell(
onTap: () {
final pizzaViewModel =
Provider.of<PizzaViewModel>(context, listen: false);
pizzaViewModel.selectedPizzaObj = {};
SetupRoutes.push(context, Routes.DIYPIZZA);
},
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 10),
alignment: Alignment.center,
width: 150,
height: 70.toHeight,
decoration: BoxDecoration(
color: isCustomBuild ? ColorConstants.white : ColorConstants.amber,
border: const Border(),
borderRadius: BorderRadius.all(
Radius.circular(20.toWidth),
),
boxShadow: [
const BoxShadow(
color: ColorConstants.amber,
blurRadius: 2,
offset: Offset(-3.0, -0.2),
)
],
),
child: Text(
text,
style: TextStyle(
color:
isCustomBuild ? ColorConstants.amber : ColorConstants.white,
fontSize: 15,
fontWeight: FontWeight.bold),
),
),
);
}
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/screens/diy_pizza_screen.dart | import 'dart:async';
import 'dart:typed_data';
import 'package:pizza_animation/components/ingridient.dart';
import 'package:pizza_animation/components/pizza.dart';
import 'package:pizza_animation/routes/route_names.dart';
import 'package:pizza_animation/services/size_config.dart';
import 'package:pizza_animation/utils/colors.dart';
import 'package:pizza_animation/utils/constants.dart';
import 'package:pizza_animation/utils/text_styles.dart';
import 'package:pizza_animation/view_models/ingridients_view_model.dart';
import 'package:pizza_animation/view_models/pizza_view_model.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:screenshot/screenshot.dart';
class DIYPizzaScreen extends StatefulWidget {
DIYPizzaScreen({
Key? key,
}) : super(key: key);
@override
_DIYPizzaScreenState createState() => _DIYPizzaScreenState();
}
class _DIYPizzaScreenState extends State<DIYPizzaScreen>
with TickerProviderStateMixin {
late AnimationController _controller;
late Animation<double> pizzaScale;
late Map<String, dynamic> selectedPizza;
String? pizzaPath;
ScreenshotController screenshotController = ScreenshotController();
@override
void initState() {
super.initState();
selectedPizza =
Provider.of<PizzaViewModel>(context, listen: false).selectedPizzaObj;
pizzaPath = selectedPizza['path'] ?? null;
_controller = AnimationController(
duration: const Duration(milliseconds: 300),
vsync: this,
);
pizzaScale = Tween<double>(
begin: 1,
end: 1.04,
).animate(CurvedAnimation(
parent: _controller,
curve: Curves.easeOut,
));
}
@override
Widget build(BuildContext context) {
PizzaViewModel pizzaViewModel = context.watch<PizzaViewModel>();
return Scaffold(
body: SafeArea(
child: SingleChildScrollView(
child: Container(
color: Colors.white,
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
SizedBox(height: 20.toHeight),
Container(
height: 40.toHeight,
padding: EdgeInsets.symmetric(horizontal: 20.toWidth),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
onTap: () {
Provider.of<IngridientsViewModel>(context,
listen: false)
.ingridients = [];
Provider.of<PizzaViewModel>(context, listen: false)
.selectedPizzaObj = {};
Navigator.pop(context);
},
child: Icon(
Icons.chevron_left,
size: 40.toFont,
color: ColorConstants.Blue_Gray,
),
),
// Icon(
// Icons.shopping_cart_outlined,
// size: 35.toFont,
// color: ColorConstants.amber,
// ),
],
),
),
Padding(
padding: EdgeInsets.only(
left: Constants.PIZZAPADDING,
right: Constants.PIZZAPADDING,
),
child: Pizza(
screenshotController: screenshotController,
scale: pizzaScale,
controller: _controller,
pizzaPath: pizzaPath ?? null,
),
),
SizedBox(height: 8.toHeight),
Text("\₹${pizzaViewModel.pizzaPrice.toInt().toString()}",
style: CustomTextStyles.priceStyle()),
SizedBox(height: 8.toHeight),
if (pizzaPath == null)
Text(
"Choose Sauce Type",
style: CustomTextStyles.chooseSauceTypeTextStyle(size: 18),
),
if (pizzaPath == null) SizedBox(height: 15.toHeight),
if (pizzaPath == null)
Container(
width: double.infinity,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
SizedBox(width: 40.toWidth),
buildSauceType(
"Plain",
SauceType.Plain,
),
buildSauceType(
"Peppery Red",
SauceType.PepperyRed,
),
buildSauceType(
"Traditional Tomato",
SauceType.TraditionalTomato,
),
buildSauceType(
"Spicy Red",
SauceType.SpicyRed,
),
buildSauceType(
"None 🤯",
SauceType.None,
),
],
),
),
),
SizedBox(height: 20.toHeight),
Text(
"Choose Toppings",
style: CustomTextStyles.chooseSauceTypeTextStyle(size: 18),
),
SizedBox(height: 10.toHeight),
Container(
width: double.infinity,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Padding(
padding: EdgeInsets.symmetric(vertical: 15.0.toHeight),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(width: 40.toWidth),
buildIngridientContainer(Ingridients.SAUSAGE),
buildIngridientContainer(Ingridients.MASHROOM),
buildIngridientContainer(Ingridients.ONION),
buildIngridientContainer(Ingridients.BASIL),
buildIngridientContainer(Ingridients.BROCCOLI),
],
),
),
),
),
SizedBox(height: 20.toHeight),
GestureDetector(
onTap: () async {
Uint8List? image = await screenshotController.capture();
if (image != null) {
context.read<PizzaViewModel>().pizzaImage = image;
}
Navigator.pushNamed(context, Routes.CHECKOUT);
},
child: Container(
width: (MediaQuery.of(context).size.width - 80).toWidth,
decoration: BoxDecoration(
color: ColorConstants.Blue_Gray,
borderRadius: BorderRadius.circular(20)),
padding: EdgeInsets.symmetric(vertical: 16.toHeight),
child: Center(
child: Text(
"BUY NOW",
style: CustomTextStyles.buyNowTextStyle(),
),
),
),
),
],
),
),
),
),
);
}
Widget buildSauceType(String text, SauceType sauceType) {
PizzaViewModel pizzaViewModel =
Provider.of<PizzaViewModel>(context, listen: true);
IngridientsViewModel ingridientsViewModel =
Provider.of<IngridientsViewModel>(context);
return GestureDetector(
onTap: () {
bool hasIngridients = ingridientsViewModel.ingridients.length > 0;
if (hasIngridients) pizzaViewModel.animateRev();
Timer(Duration(milliseconds: hasIngridients ? 800 : 100), () {
pizzaViewModel.pizzaAnimationController.reverse();
});
Timer(Duration(milliseconds: hasIngridients ? 1400 : 700), () {
pizzaViewModel.setSauceType(sauceType);
pizzaViewModel.pizzaAnimationController.forward();
});
if (hasIngridients)
Timer(Duration(milliseconds: 2000), () {
pizzaViewModel.animateForward();
pizzaViewModel.setSauceType(sauceType);
});
else
Timer(Duration(milliseconds: 2000), () {
pizzaViewModel.setSauceType(sauceType);
});
},
child: Container(
margin: EdgeInsets.only(right: 5.toWidth),
padding: EdgeInsets.symmetric(
vertical: 7.toHeight,
horizontal: 17.toWidth,
),
decoration: BoxDecoration(
border: Border.all(
color: ColorConstants.amber,
width: 2,
),
borderRadius: BorderRadius.circular(10),
color: pizzaViewModel.sauceType == sauceType
? ColorConstants.amber
: Colors.white,
),
child: Text(
text,
style: CustomTextStyles.pizzaSauceTextStyle(
size: 14,
color: pizzaViewModel.sauceType == sauceType
? Colors.white
: ColorConstants.amber,
),
),
),
);
}
Container buildIngridientContainer(Ingridients ingridient) {
return Container(
height: 70.toHeight,
width: 70.toWidth,
margin: EdgeInsets.only(right: 20.toWidth),
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
color: Colors.yellow[100],
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.2),
spreadRadius: 5,
blurRadius: 7,
offset: Offset(0, 3), // changes position of shadow
),
],
shape: BoxShape.circle,
),
child: Ingridient(path: ingridient),
);
}
}
enum Ingridients {
BASIL,
BROCCOLI,
MASHROOM,
ONION,
SAUSAGE,
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/screens/splash_screen.dart | import 'package:pizza_animation/routes/route_names.dart';
import 'package:pizza_animation/routes/routes.dart';
import 'package:pizza_animation/services/firebase_service.dart';
import 'package:pizza_animation/utils/constants.dart';
import 'package:flutter/material.dart';
import 'package:lottie/lottie.dart';
class Splash extends StatefulWidget {
@override
_SplashState createState() => _SplashState();
}
class _SplashState extends State<Splash> {
@override
void initState() {
Future.delayed(Duration(seconds: 3), () {
if (FirebaseService().checkState()) {
SetupRoutes.pushAndRemoveAll(context, Routes.HOME);
} else {
SetupRoutes.pushAndRemoveAll(context, Routes.ONBOARDING);
}
});
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.amber,
body: Center(
child: Lottie.asset(Constants.PIZZA_SLICE_ANIMATION),
),
);
}
}
| 0 |
mirrored_repositories/pizza-animation/lib | mirrored_repositories/pizza-animation/lib/screens/pizza_selection_screen.dart | import 'dart:math' as math;
import 'package:pizza_animation/components/pizzaBg.dart';
import 'package:pizza_animation/components/pizza_details.dart';
import 'package:pizza_animation/screens/diy_pizza_screen.dart';
import 'package:pizza_animation/services/size_config.dart';
import 'package:pizza_animation/utils/colors.dart';
import 'package:pizza_animation/utils/constants.dart';
import 'package:pizza_animation/utils/text_styles.dart';
import 'package:pizza_animation/view_models/ingridients_view_model.dart';
import 'package:pizza_animation/view_models/pizza_view_model.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class PizzaSelection extends StatefulWidget {
@override
_PizzaSelectionState createState() => _PizzaSelectionState();
}
class _PizzaSelectionState extends State<PizzaSelection>
with TickerProviderStateMixin {
PageController _pageController =
PageController(initialPage: 1, viewportFraction: 0.6);
int _currentPageIndex = 1;
late AnimationController _pizzaTransformController;
var images = [
'assets/Bread/Bread_1.png',
'assets/Bread/Bread_2.png',
'assets/Bread/Bread_3.png'
];
var _tweenPizzaTransform = Tween<double>(
begin: 0.6,
end: 1.15,
);
late Animation<double> curve;
late Animation<double> rotate;
late Animation<double> rotateBg;
late double rotateVal = 0;
late Map<String, dynamic> pizzaObj = Constants.pizzaList[1];
@override
void initState() {
_pizzaTransformController =
AnimationController(vsync: this, duration: Duration(milliseconds: 300));
curve = _tweenPizzaTransform.animate(CurvedAnimation(
parent: _pizzaTransformController, curve: Curves.easeOut));
rotate = Tween<double>(
begin: 0,
end: 0.5,
).animate(
CurvedAnimation(
parent: _pizzaTransformController,
curve: Curves.easeOut,
),
);
rotateBg = Tween<double>(
begin: 0,
end: math.pi / 4,
).animate(
CurvedAnimation(
parent: _pizzaTransformController,
curve: Interval(0, 1, curve: Curves.easeOut),
),
);
_pageController.addListener(() {
pizzaObj = Constants.pizzaList[_pageController.page!.round()];
setState(() {});
});
animate();
super.initState();
}
animate() {
if (_pizzaTransformController.isCompleted) {
_pizzaTransformController.reverse();
_pizzaTransformController.reset();
}
_pizzaTransformController.forward();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: SingleChildScrollView(
child: Container(
padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top),
height: MediaQuery.of(context).size.height,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.symmetric(
horizontal: 20.toWidth,
vertical: 20.toHeight,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
GestureDetector(
onTap: () {
Provider.of<IngridientsViewModel>(context,
listen: false)
.ingridients = [];
Provider.of<PizzaViewModel>(context, listen: false)
.selectedPizzaObj = {};
Navigator.pop(context);
},
child: Icon(
Icons.chevron_left,
size: 30.toFont,
color: ColorConstants.Blue_Gray,
),
),
Text(
"Customize",
style: CustomTextStyles.orderPizza(),
),
Icon(
Icons.shopping_cart_outlined,
color: ColorConstants.Blue_Gray,
size: 35.toFont,
),
],
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 20.toWidth),
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 15.toWidth,
vertical: 5.toHeight,
),
decoration: BoxDecoration(
color: ColorConstants.amber,
borderRadius: BorderRadius.circular(10),
),
child: Text(
"Pizza",
style: CustomTextStyles.pizza(),
),
),
),
// SizedBox(height: 60),
Expanded(
child: Stack(
children: [
Positioned(
left: 65.toWidth,
top: 49.toHeight,
child: Container(
alignment: Alignment.center,
width: (MediaQuery.of(context).size.width - 143)
.toWidth, // customize pizza size
height: 400.toHeight,
child: Column(
children: [Image.asset("assets/Plate.png")],
mainAxisAlignment: MainAxisAlignment.start,
),
),
),
Positioned(
bottom: 30.toHeight,
left:
(MediaQuery.of(context).size.width / 2 - 125.toWidth),
child: PizzaDetails(pizzaObj: pizzaObj),
),
Positioned(
left: 0,
child: Transform.rotate(
angle: rotateVal + rotateBg.value,
child: PizzaBg(),
),
),
Container(
padding: EdgeInsets.only(top: 42.toHeight),
height: 650.toHeight,
child: PageView.builder(
itemCount: Constants.pizzaList.length,
controller: _pageController,
onPageChanged: (i) {
setState(() {
_currentPageIndex = i;
animate();
rotateVal += math.pi / 4;
});
},
itemBuilder: (context, i) {
return Container(
padding: EdgeInsets.only(top: 16.toHeight),
child: AnimatedBuilder(
animation: _pizzaTransformController,
builder: (content, _) {
return Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
// this is used to move unselected pizza pallete down
AnimatedContainer(
duration: Duration(milliseconds: 200),
height: _currentPageIndex != i
? (curve.value * 220).toHeight
: 0,
),
Transform.rotate(
angle: rotate.value,
child: Transform.scale(
scale: _currentPageIndex == i
? curve.value
: (_tweenPizzaTransform.begin! +
_tweenPizzaTransform.end! -
curve.value),
child: GestureDetector(
onTap: () {
final pizzaViewModel =
Provider.of<PizzaViewModel>(
context,
listen: false);
pizzaViewModel.selectedPizzaObj =
pizzaObj;
pizzaViewModel.pizzaPrice =
double.parse(
pizzaObj['price']);
Navigator.push(
context,
_createRoute(pizzaObj['name']),
);
},
child: Container(
padding: EdgeInsets.all(18),
child: Image.asset(
Constants.pizzaList[i]['path'],
),
),
),
),
),
// this is used to move selected pizza pallete up
AnimatedContainer(
duration: Duration(milliseconds: 200),
height: _currentPageIndex == i
? curve.value * 100
: 0,
)
],
);
}),
);
},
),
),
],
),
),
],
),
),
),
);
}
}
Route _createRoute(String path) {
return PageRouteBuilder(
pageBuilder: (context, animation, secondaryAnimation) {
return DIYPizzaScreen();
},
transitionsBuilder: (context, animation, secondaryAnimation, child) {
const begin = Offset(0.1, 1.0);
const end = Offset.zero;
var tween = Tween(begin: begin, end: end).chain(
CurveTween(curve: Curves.ease),
);
return SlideTransition(
position: animation.drive(tween),
child: child,
);
},
);
}
| 0 |
mirrored_repositories/pizza-animation/lib/screens | mirrored_repositories/pizza-animation/lib/screens/user_form/user_form.dart | import 'package:pizza_animation/common_components/loading_widget.dart';
import 'package:pizza_animation/model/user_data.dart';
import 'package:pizza_animation/routes/route_names.dart';
import 'package:pizza_animation/routes/routes.dart';
import 'package:pizza_animation/services/firebase_service.dart';
import 'package:pizza_animation/services/firestore_service.dart';
import 'package:pizza_animation/services/size_config.dart';
import 'package:pizza_animation/utils/colors.dart';
import 'package:pizza_animation/utils/images.dart';
import 'package:pizza_animation/utils/text_styles.dart';
import 'package:pizza_animation/view_models/user_data_provider.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class UserForm extends StatefulWidget {
const UserForm({Key? key}) : super(key: key);
@override
_UserFormState createState() => _UserFormState();
}
class _UserFormState extends State<UserForm> {
GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
var formFields = [];
String? _phoneController,
_nameController,
_emailController,
_addressController;
String? _errorText;
late UserData _userData;
@override
void initState() {
_userData = UserData(
name: '',
phoneNumber: '${FirebaseService().firebaseAuth.currentUser!.phoneNumber}',
address: '',
);
_phoneController = FirebaseService().firebaseAuth.currentUser!.phoneNumber;
formFields = [
{
'label': 'Phone Number',
'hintText': 'Enter Phone Number',
'controller': _phoneController,
'readOnly': true,
'function': (String value) {
_phoneController = value;
},
},
{
'label': 'Name *',
'hintText': 'Enter your name',
'controller': _nameController,
'readOnly': false,
'function': (String value) {
_nameController = value;
},
},
{
'label': 'Email',
'hintText': 'Enter Email',
'controller': _emailController,
'readOnly': false,
'function': (String value) {
_emailController = value;
},
},
{
'label': 'Address *',
'hintText': 'Enter your delivery address',
'controller': _addressController,
'readOnly': false,
'function': (String value) {
_addressController = value;
},
},
];
super.initState();
}
String getField(String label) {
switch (label) {
case 'Phone Number':
return _userData.phoneNumber;
case 'Name *':
return _userData.name;
case 'Email':
return _userData.email ?? '';
case 'Address *':
return _userData.address;
default:
return '';
}
}
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
key: _scaffoldKey,
resizeToAvoidBottomInset: false,
backgroundColor: ColorConstants.lightGrey,
body: Row(
children: [
Container(
width: 10.toWidth,
height: SizeConfig().screenHeight,
color: ColorConstants.Blue_Gray,
),
Expanded(
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(height: 60.toHeight),
Container(
height: 100,
width: 100,
child: Image.asset(ImageAssets.USER_FORM_IMAGE),
),
Text(
"Welcome",
style: TextStyle(
color: ColorConstants.black,
fontSize: 28.toFont,
fontWeight: FontWeight.w700,
),
),
SizedBox(height: 10.toHeight),
Padding(
padding: EdgeInsets.symmetric(horizontal: 50.toWidth),
child: Text(
"Please fill all details for better experiance",
style: TextStyle(
color: ColorConstants.DARK_GREY,
fontSize: 14.toFont,
fontWeight: FontWeight.w500,
),
textAlign: TextAlign.center,
),
),
SizedBox(height: 50.toHeight),
Column(
children: formFields.map((_field) {
return _textField(
_field['label'],
_field['hintText'],
_field['controller'],
_field['readOnly'],
_field['function']);
}).toList(),
),
SizedBox(height: 30.toHeight),
_errorText != null
? Text(
_errorText!,
style: TextStyle(
color: ColorConstants.red,
fontSize: 14.toFont,
fontWeight: FontWeight.w500,
),
textAlign: TextAlign.center,
)
: SizedBox(),
SizedBox(height: 50.toHeight),
_saveButton(),
SizedBox(height: 20.toHeight),
],
),
),
)
],
),
),
);
}
Widget _textField(String label, String hintText, String? controller,
bool readOnly, Function(String)? onChanged) {
return Column(
children: [
Container(
alignment: Alignment.centerLeft,
padding: EdgeInsets.only(left: 30.0, top: 30.0),
child: Text(label,
style: TextStyle(
color: ColorConstants.DARK_GREY,
fontSize: 16.toFont,
)),
),
Container(
padding: EdgeInsets.only(
left: 30.0.toWidth, right: 30.0.toWidth, top: 10.0.toHeight),
width: double.infinity,
child: TextFormField(
autovalidateMode: (controller?.isNotEmpty ?? false)
? AutovalidateMode.always
: AutovalidateMode.onUserInteraction,
readOnly: readOnly,
autofocus: false,
textInputAction: TextInputAction.next,
initialValue: getField(label),
onChanged: onChanged,
style: TextStyle(
color: ColorConstants.black,
fontSize: 20,
),
decoration: InputDecoration(
hintText: hintText,
hintStyle: TextStyle(
color: ColorConstants.LIGHT_GREY,
fontSize: 16.toFont,
),
contentPadding:
EdgeInsets.only(top: 20.0, left: 10.0, right: 10.0),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(5.0),
borderSide: BorderSide(color: Colors.blueAccent, width: 2),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(5.0),
borderSide: BorderSide(color: Color(0xFFEBEBEB), width: 2)),
focusedErrorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(5.0),
borderSide: BorderSide(color: ColorConstants.RED, width: 2)),
errorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(5.0),
borderSide: BorderSide(color: ColorConstants.RED, width: 2)),
),
validator: (value) {
if ((label.contains('*')) && (value == null || value.isEmpty)) {
return "Cannot leave this empty";
}
return null;
},
),
),
],
);
}
Widget _saveButton() {
return Padding(
padding: EdgeInsets.only(left: 30.toWidth),
child: InkWell(
onTap: _onSaveCall,
child: Container(
padding: EdgeInsets.symmetric(horizontal: 40.toHeight),
alignment: Alignment.center,
width: double.infinity,
height: 60.toHeight,
decoration: BoxDecoration(
color: ColorConstants.DARK_GREY,
border: Border(),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20.toWidth),
bottomLeft: Radius.circular(20.toWidth),
),
boxShadow: [
BoxShadow(
color: ColorConstants.DARK_GREY,
blurRadius: 5,
// spreadRadius: 8,
offset: Offset(-3.0, -0.2),
)
],
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Save',
style: TextStyle(
color: ColorConstants.white,
fontSize: 20.toWidth,
),
),
RichText(
text: TextSpan(
text: '🎯',
style: CustomTextStyles.customTextStyle(
ColorConstants.white.withOpacity(0.2),
size: 20,
),
children: [
TextSpan(
text: '🎯',
style: CustomTextStyles.customTextStyle(
ColorConstants.white.withOpacity(0.4),
size: 20,
),
),
TextSpan(
text: '🎯',
style: CustomTextStyles.customTextStyle(
ColorConstants.white,
size: 20,
),
)
],
),
)
],
),
),
),
);
}
_onSaveCall() async {
if (_nameController?.isEmpty ?? true) {
_errorText = 'Please enter fields marked with *';
setState(() {});
return;
}
if (_addressController?.isEmpty ?? true) {
_errorText = 'Please enter fields marked with *';
setState(() {});
return;
}
var _userData = UserData(
name: _nameController!,
phoneNumber: _phoneController!,
address: _addressController!,
email: _emailController,
);
print('_userData $_userData');
LoadingDialog().show(text: 'Setting user details');
var _userDataProvider =
Provider.of<UserDataProvider>(context, listen: false);
await _userDataProvider.setUserDetails(_userData);
LoadingDialog().hide();
if (_userDataProvider.userData != null) {
SetupRoutes.pushAndRemoveAll(context, Routes.HOME);
} else {
ScaffoldMessenger.of(_scaffoldKey.currentContext!).showSnackBar(SnackBar(
backgroundColor: ColorConstants.RED,
content: Text(
'Failed, Try again!',
style: CustomTextStyles.customTextStyle(
ColorConstants.white,
),
),
));
}
}
}
| 0 |
mirrored_repositories/pizza-animation/lib/screens | mirrored_repositories/pizza-animation/lib/screens/splash/splash.dart | import 'package:pizza_animation/common_components/loading_widget.dart';
import 'package:pizza_animation/routes/route_names.dart';
import 'package:pizza_animation/routes/routes.dart';
import 'package:pizza_animation/screens/splash/log_in/log_in.dart';
import 'package:pizza_animation/services/firebase_service.dart';
import 'package:pizza_animation/services/size_config.dart';
import 'package:pizza_animation/utils/colors.dart';
import 'package:pizza_animation/utils/images.dart';
import 'package:pizza_animation/utils/text_styles.dart';
import 'package:pizza_animation/view_models/user_data_provider.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:provider/provider.dart';
class Onboarding extends StatefulWidget {
@override
_OnboardingState createState() => _OnboardingState();
}
class _OnboardingState extends State<Onboarding> with TickerProviderStateMixin {
final GlobalKey<AnimatedListState> listKey = GlobalKey<AnimatedListState>();
late AnimationController _textController, _inputBoxController;
late Animation _textAnimation;
late Tween<double> _textHeight;
late String text;
late bool isLogin, isPhoneNumberScreen, isSignedIn;
@override
void initState() {
// FirebaseService().signOut();
text = "Let's do it!";
isLogin = true;
_textController =
AnimationController(vsync: this, duration: Duration(milliseconds: 400));
_inputBoxController =
AnimationController(vsync: this, duration: Duration(milliseconds: 400));
_textHeight = Tween<double>(begin: 400, end: 150);
_textAnimation = _textHeight.animate(_textController);
// isSignedIn = true;
isSignedIn = FirebaseService().checkState();
print('isSignedIn $isSignedIn');
///TODO: remove this
// FirebaseService().firebaseAuth.signOut();
// isSignedIn = false;
super.initState();
}
_animate() {
print('animate called');
setState(() {
isLogin = false;
});
_textController.forward().then((value) => _inputBoxController.forward());
}
@override
Widget build(BuildContext context) {
SizeConfig().init(context);
return Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: ColorConstants.lightGrey,
body: Row(
children: [
Container(
width: 10.toWidth,
height: SizeConfig().screenHeight,
color: ColorConstants.Blue_Gray,
),
Expanded(
child: SingleChildScrollView(
child: Column(children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 50.toWidth),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 60.toHeight),
Text(
"Make your own Pizza, it's great !!",
style: TextStyle(
color: ColorConstants.black,
fontSize: 38.toFont,
fontWeight: FontWeight.w700,
// fontFamily: 'Montserrat',
),
),
],
),
),
SizedBox(height: isLogin ? 25.toHeight : 0),
isLogin
? Padding(
padding: EdgeInsets.only(left: 40.toHeight),
child: Divider(),
)
: SizedBox(),
SizedBox(height: isLogin ? 25.toHeight : 0),
isLogin
? Align(
alignment: Alignment.centerRight,
child: InkWell(
onTap: isSignedIn
? () async {
// SetupRoutes.pushAndRemoveAll(
// context, Routes.USER_FORM);
LoadingDialog()
.show(text: 'Fetching user details');
var _userDataProvider =
Provider.of<UserDataProvider>(context,
listen: false);
await _userDataProvider.getUserDetails();
LoadingDialog().hide();
if (_userDataProvider.userData == null) {
SetupRoutes.pushAndRemoveAll(
context, Routes.USER_FORM);
} else {
SetupRoutes.pushAndRemoveAll(
context, Routes.HOME);
}
}
: _animate,
child: Container(
padding:
EdgeInsets.symmetric(horizontal: 40.toHeight),
alignment: Alignment.center,
width: SizeConfig().screenWidth - 50.toWidth,
height: 70.toHeight,
decoration: BoxDecoration(
color: ColorConstants.DARK_GREY,
border: Border(),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20.toWidth),
bottomLeft: Radius.circular(20.toWidth),
),
boxShadow: [
BoxShadow(
color: ColorConstants.DARK_GREY,
blurRadius: 5,
// spreadRadius: 8,
offset: Offset(-3.0, -0.2),
)
],
),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
text,
style: TextStyle(
color: ColorConstants.white,
fontSize: 26.toWidth,
),
),
RichText(
text: TextSpan(
text: '🍕',
style: CustomTextStyles.customTextStyle(
ColorConstants.white.withOpacity(0.2),
size: 25,
),
children: [
TextSpan(
text: '🍕',
style:
CustomTextStyles.customTextStyle(
ColorConstants.white
.withOpacity(0.4),
size: 25,
),
),
TextSpan(
text: '🍕',
style:
CustomTextStyles.customTextStyle(
ColorConstants.white,
size: 25,
),
)
],
),
)
],
),
),
),
)
: SizedBox(
height: 0,
),
isLogin
? SizedBox(
// height: 200.toHeight,
)
: SlideTransition(
position: Tween<Offset>(
begin: const Offset(1, 0),
end: Offset.zero,
).animate(_inputBoxController),
child: Login(),
),
Container(
child: Image.asset(
ImageAssets.SPLASH_BG,
height: 400.toHeight,
),
)
]),
),
),
],
));
}
}
| 0 |
mirrored_repositories/pizza-animation/lib/screens/splash | mirrored_repositories/pizza-animation/lib/screens/splash/log_in/log_in.dart | import 'dart:ui';
import 'package:pizza_animation/common_components/loading_widget.dart';
import 'package:pizza_animation/routes/route_names.dart';
import 'package:pizza_animation/routes/routes.dart';
import 'package:pizza_animation/services/firebase_service.dart';
import 'package:pizza_animation/utils/colors.dart';
import 'package:pizza_animation/utils/text_styles.dart';
import 'package:pizza_animation/view_models/user_data_provider.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class Login extends StatefulWidget {
@override
_LoginState createState() => _LoginState();
}
class _LoginState extends State<Login> with TickerProviderStateMixin {
final GlobalKey<AnimatedListState> listKey = GlobalKey<AnimatedListState>();
late AnimationController _phoneNoController, _otpController;
late bool _isPhoneNumberScreen;
late TextEditingController _phoneNumberController, _otpNumberController;
String _errorText = '';
@override
void initState() {
_isPhoneNumberScreen = true;
_phoneNoController = AnimationController(
vsync: this, duration: const Duration(milliseconds: 200));
_otpController = AnimationController(
vsync: this, duration: const Duration(milliseconds: 200));
_phoneNumberController = TextEditingController();
_otpNumberController = TextEditingController();
super.initState();
}
_animateToPhoneNumber({bool isReverse = false}) async {
if (!isReverse) {
_phoneNoController.forward();
return;
}
_phoneNoController.reverse();
}
_animateToOtp({bool isReverse = false}) async {
if (_phoneNumberController.text.isEmpty) {
setState(() {
_errorText = 'Phone number cannot be empty';
});
return;
} else {
setState(() {
_errorText = '';
});
}
/// To move phone number and bring otp
if (!isReverse) {
LoadingDialog().show(text: 'Verifying Phone Number');
var _isValid = await _verifyPhoneNumber();
LoadingDialog().hide();
if (_isValid) {
_animateToPhoneNumber();
_otpController.forward();
setState(() {
_isPhoneNumberScreen = false;
});
} else {
setState(() {
_errorText = 'Phone number not valid';
});
}
return;
}
setState(() {
_isPhoneNumberScreen = true;
});
_animateToPhoneNumber(isReverse: isReverse);
_otpController.reverse();
}
Future<bool> _verifyPhoneNumber() async {
var _result =
await FirebaseService().verifyPhoneNumber(_phoneNumberController.text);
return _result;
}
_verifyOTPNumber() async {
if (_otpNumberController.text.isEmpty) {
setState(() {
_errorText = 'OTP cannot be empty';
});
return;
} else {
setState(() {
_errorText = '';
});
}
LoadingDialog().show(text: 'Verifying OTP');
var _result = await FirebaseService().verifyOTP(_otpNumberController.text);
LoadingDialog().hide();
if (_result != null) {
LoadingDialog().show(text: 'Fetching user details');
var _userDataProvider =
Provider.of<UserDataProvider>(context, listen: false);
await _userDataProvider.getUserDetails();
LoadingDialog().hide();
if (_userDataProvider.userData == null) {
SetupRoutes.pushAndRemoveAll(context, Routes.USER_FORM);
} else {
SetupRoutes.pushAndRemoveAll(context, Routes.HOME);
}
} else {
setState(() {
_errorText = 'OTP verification failed';
});
}
}
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
alignment: Alignment.centerLeft,
padding: const EdgeInsets.only(left: 15.0, top: 30.0),
decoration: BoxDecoration(
border: const Border(), borderRadius: BorderRadius.circular(30)),
height: _isPhoneNumberScreen ? 0 : 80,
child: _isPhoneNumberScreen
? const SizedBox()
: IconButton(
icon: const Icon(
Icons.keyboard_arrow_left_rounded,
color: ColorConstants.black,
),
iconSize: 40,
padding: const EdgeInsets.all(0),
onPressed: () => _animateToOtp(isReverse: true)),
),
_isPhoneNumberScreen
? SlideTransition(
position: Tween<Offset>(
begin: const Offset(0, 0),
end: const Offset(-1, 0),
).animate(_phoneNoController),
child: phoneNumberScreen(),
)
: SlideTransition(
position: Tween<Offset>(
begin: const Offset(1, 0),
end: Offset.zero,
).animate(_otpController),
child: otpScreen(),
),
_errorText.length != 0
? Text(
'$_errorText',
style: CustomTextStyles.customTextStyle(ColorConstants.red,
size: 16),
)
: const SizedBox(),
_errorText.length != 0 ? const SizedBox(height: 7) : const SizedBox(),
TextButton(
onPressed: () async {
if (_isPhoneNumberScreen) {
/// Check mobile no is valid & send an OTP, then
await _animateToOtp();
} else {
/// verify otp entered is correct, then
await _verifyOTPNumber();
}
},
child: Container(
alignment: Alignment.center,
width: 140,
height: 50,
child: Text(
_isPhoneNumberScreen ? 'Next' : 'Submit',
style: const TextStyle(
color: ColorConstants.white,
fontSize: 20,
),
),
decoration: BoxDecoration(
color: ColorConstants.Blue_Gray,
border: const Border(),
borderRadius: BorderRadius.circular(20)),
),
)
],
);
}
phoneNumberScreen() {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
const SizedBox(
height: 30,
),
Container(
alignment: Alignment.centerLeft,
padding: const EdgeInsets.only(left: 30.0, top: 30.0),
child: const Text("Phone Number",
style: TextStyle(
color: ColorConstants.DARK_GREY,
fontSize: 20,
)),
),
Container(
padding: const EdgeInsets.only(left: 30.0, right: 30.0, top: 10.0),
child: TextFormField(
autofocus: false,
textInputAction: TextInputAction.next,
controller: _phoneNumberController,
// textDirection: TextDirection.rtl,
style: const TextStyle(
color: ColorConstants.black,
fontSize: 20,
),
decoration: InputDecoration(
// hintTextDirection: TextDirection.rtl,
prefixText: '+91 ',
prefixStyle: const TextStyle(color: Colors.black, fontSize: 16),
// floatingLabelBehavior: FloatingLabelBehavior.always,
hintText: "Enter Phone Number",
hintStyle: const TextStyle(
color: ColorConstants.LIGHT_GREY,
fontSize: 16,
),
contentPadding:
const EdgeInsets.only(top: 20.0, left: 10.0, right: 10.0),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(5.0),
borderSide:
const BorderSide(color: Colors.blueAccent, width: 2),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(5.0),
borderSide:
const BorderSide(color: Color(0xFFEBEBEB), width: 2)),
),
// onChanged: (val) {
// if (_phoneNumberController.text.isEmpty) {
// setState(() {
// _errorText = 'Phone number cannot be empty';
// });
// return;
// } else {
// setState(() {
// _errorText = '';
// });
// }
// },
validator: (value) {
if (value == null || value.isEmpty) {
return "Can't leave this empty";
}
return null;
},
),
),
Container(
height: 30,
),
],
);
}
otpScreen() {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// SizedBox(
// height: 30,
// ),
Container(
alignment: Alignment.centerLeft,
padding: const EdgeInsets.only(left: 30.0, top: 30.0),
child: const Text("Otp",
style: TextStyle(
color: ColorConstants.DARK_GREY,
fontSize: 20,
)),
),
Container(
padding: const EdgeInsets.only(left: 30.0, right: 30.0, top: 10.0),
child: TextFormField(
autofocus: false,
textInputAction: TextInputAction.next,
controller: _otpNumberController,
style: const TextStyle(
color: ColorConstants.black,
fontSize: 20,
),
decoration: InputDecoration(
hintText: "Enter OTP",
hintStyle: const TextStyle(
color: ColorConstants.LIGHT_GREY,
fontSize: 16,
),
contentPadding:
const EdgeInsets.only(top: 20.0, left: 10.0, right: 10.0),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(5.0),
borderSide:
const BorderSide(color: Colors.blueAccent, width: 2)),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(5.0),
borderSide:
const BorderSide(color: Color(0xFFEBEBEB), width: 2)),
),
validator: (value) {
if (value == null || value.isEmpty) {
return "Can't leave this empty";
}
return null;
},
),
),
const SizedBox(
height: 30,
),
],
);
}
}
| 0 |
mirrored_repositories/pizza-animation | mirrored_repositories/pizza-animation/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pizza_animation/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
| 0 |
mirrored_repositories/Hackathon-Tom | mirrored_repositories/Hackathon-Tom/lib/main.dart | import 'package:flutter/material.dart';
import 'package:future_hacks/screens/screen1.dart';
void main() => runApp(MyHomePage());
class MyHomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'HackaTom',
initialRoute: Screen1.routeName,
routes: {
Screen1.routeName: (_) => Screen1(),
},
);
}
}
| 0 |
mirrored_repositories/Hackathon-Tom/lib | mirrored_repositories/Hackathon-Tom/lib/utilities/hacks.dart | List hacks = [
{
"duration": 10800,
"end": "2019-11-02T18:00:00",
"event": "UEM CODESTORM 2.0",
"href":
"http://www.codechef.com/UEM22019?utm_source=contest_listing&utm_medium=link&utm_campaign=UEM22019",
"id": 16063850,
"resource": {"id": 2, "name": "codechef.com"},
"start": "2019-11-02T15:00:00"
},
{
"duration": 10800,
"end": "2019-11-17T08:00:00",
"event": "Kick Start Round H",
"href":
"https://codingcompetitions.withgoogle.com/kickstart/round/0000000000050edd",
"id": 13898980,
"resource": {"id": 35, "name": "codingcompetitions.withgoogle.com"},
"start": "2019-11-17T05:00:00"
},
{
"duration": 7808400,
"end": "2020-06-27T00:00:00",
"event": "Statue of Liberty",
"href": "http://www.azspcs.net/",
"id": 15893756,
"resource": {"id": 66, "name": "azspcs.net"},
"start": "2020-03-28T15:00:00"
},
{
"duration": 129600,
"end": "2019-10-13T15:30:00",
"event": "Hack for TRAI",
"href": "https://trai.hackerearth.com/",
"id": 15904253,
"resource": {"id": 73, "name": "hackerearth.com"},
"start": "2019-10-12T03:30:00"
},
{
"duration": 9000,
"end": "2019-10-20T18:30:00",
"event": "October Cook-Off 2019",
"href":
"http://www.codechef.com/COOK111?utm_source=contest_listing&utm_medium=link&utm_campaign=COOK111",
"id": 13670989,
"resource": {"id": 2, "name": "codechef.com"},
"start": "2019-10-20T16:00:00"
},
{
"duration": 18000,
"end": "2019-10-27T11:00:00",
"event": "Программирование - профессионалы (ком. 2019)",
"href": "http://dl.gsu.by/LC.jsp?Type=-1&lng=ru",
"id": 15042851,
"resource": {"id": 4, "name": "dl.gsu.by"},
"start": "2019-10-27T06:00:00"
},
{
"duration": 172800,
"end": "2019-11-24T07:05:00",
"event": "Технокубок 2020 - Ознакомительный Раунд 3",
"href": "http://codeforces.com/contests/1226",
"id": 16077048,
"resource": {"id": 1, "name": "codeforces.com"},
"start": "2019-11-22T07:05:00"
},
{
"duration": 7200,
"end": "2019-10-26T13:05:00",
"event": "Technocup 2020 - Elimination Round 2",
"href": "http://codeforces.com/contests/1225",
"id": 16077049,
"resource": {"id": 1, "name": "codeforces.com"},
"start": "2019-10-26T11:05:00"
},
{
"duration": 7200,
"end": "2019-11-24T10:05:00",
"event": "Technocup 2020 - Elimination Round 3",
"href": "http://codeforces.com/contests/1227",
"id": 16077047,
"resource": {"id": 1, "name": "codeforces.com"},
"start": "2019-11-24T08:05:00"
},
{
"duration": 172800,
"end": "2019-10-26T10:05:00",
"event": "Технокубок 2020 - Ознакомительный Раунд 2",
"href": "http://codeforces.com/contests/1224",
"id": 16077050,
"resource": {"id": 1, "name": "codeforces.com"},
"start": "2019-10-24T10:05:00"
},
{
"duration": 21600,
"end": "2019-10-13T11:00:00",
"event": "Программирование - профессионалы (лич. 2019-2020)",
"href": "http://dl.gsu.by/LC.jsp?Type=-1&lng=ru",
"id": 15650494,
"resource": {"id": 4, "name": "dl.gsu.by"},
"start": "2019-10-13T05:00:00"
},
{
"duration": 172800,
"end": "2019-11-17T17:00:00",
"event": "ASIS CTF Finals 2019",
"href": "https://ctftime.org/event/805/",
"id": 14664970,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2019-11-15T17:00:00"
},
{
"duration": 104400,
"end": "2019-12-22T07:00:00",
"event": "SECCON 2019 Final Japan competition",
"href": "https://ctftime.org/event/800/",
"id": 14569467,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2019-12-21T02:00:00"
},
{
"duration": 172800,
"end": "2019-12-29T20:00:00",
"event": "hxp 36C3 CTF",
"href": "https://ctftime.org/event/825/",
"id": 15046520,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2019-12-27T20:00:00"
},
{
"duration": 21600,
"end": "2019-10-27T11:00:00",
"event": "Программирование - профессионалы (лич. 2019-2020)",
"href": "http://dl.gsu.by/LC.jsp?Type=-1&lng=ru",
"id": 15650498,
"resource": {"id": 4, "name": "dl.gsu.by"},
"start": "2019-10-27T05:00:00"
},
{
"duration": 25200,
"end": "2019-10-19T16:00:00",
"event": "UConn CyberSEED 2019",
"href": "https://ctftime.org/event/855/",
"id": 15714349,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2019-10-19T09:00:00"
},
{
"duration": 194100,
"end": "2019-10-13T18:25:00",
"event": "ANSYS Software Developer Hiring Challenge",
"href":
"https://www.hackerearth.com/challenges/hiring/ansys-software-engineer-hiring-2019/",
"id": 16086251,
"resource": {"id": 73, "name": "hackerearth.com"},
"start": "2019-10-11T12:30:00"
},
{
"duration": 129599,
"end": "2019-11-03T20:00:00",
"event": "Google Capture The Flag 2019",
"href": "https://ctftime.org/event/844/",
"id": 15570413,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2019-11-02T08:00:01"
},
{
"duration": 129600,
"end": "2019-10-13T15:30:00",
"event": "IndiaMART Tech Fe(A)st 2019",
"href":
"https://www.hackerearth.com/challenges/competitive/indiamart-tech-feast-2019/",
"id": 16098164,
"resource": {"id": 73, "name": "hackerearth.com"},
"start": "2019-10-12T03:30:00"
},
{
"duration": 43200,
"end": "2019-11-09T15:30:00",
"event": "INNOV-A-THON",
"href": "https://www.hackerearth.com/challenges/hackathon/innov-a-thon/",
"id": 16097231,
"resource": {"id": 73, "name": "hackerearth.com"},
"start": "2019-11-09T03:30:00"
},
{
"duration": 86400,
"end": "2019-10-20T06:00:00",
"event": "SECCON 2019 Online CTF",
"href": "https://ctftime.org/event/799/",
"id": 14569469,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2019-10-19T06:00:00"
},
{
"duration": 18000,
"end": "2019-10-20T11:00:00",
"event": "Программирование - профессионалы (ком. 2019)",
"href": "http://dl.gsu.by/LC.jsp?Type=-1&lng=ru",
"id": 15042850,
"resource": {"id": 4, "name": "dl.gsu.by"},
"start": "2019-10-20T06:00:00"
},
{
"duration": 21600,
"end": "2019-11-17T11:00:00",
"event": "Программирование - профессионалы (лич. 2019-2020)",
"href": "http://dl.gsu.by/LC.jsp?Type=-1&lng=ru",
"id": 15682874,
"resource": {"id": 4, "name": "dl.gsu.by"},
"start": "2019-11-17T05:00:00"
},
{
"duration": 18000,
"end": "2019-11-17T11:00:00",
"event": "Программирование - профессионалы (ком. 2019)",
"href": "http://dl.gsu.by/LC.jsp?Type=-1&lng=ru",
"id": 15682875,
"resource": {"id": 4, "name": "dl.gsu.by"},
"start": "2019-11-17T06:00:00"
},
{
"duration": 52200,
"end": "2019-12-23T06:30:00",
"event": "December Cook-Off 2019",
"href": "https://www.codechef.com/COOK113",
"id": 13671216,
"resource": {"id": 2, "name": "codechef.com"},
"start": "2019-12-22T16:00:00"
},
{
"duration": 194100,
"end": "2019-10-13T18:25:00",
"event": "ThoughtWorks Diversity Hiring Challenge October 2019",
"href":
"https://www.hackerearth.com/challenges/hiring/thoughtworks-diversity-hiring-challenge-october-2019/",
"id": 16139871,
"resource": {"id": 73, "name": "hackerearth.com"},
"start": "2019-10-11T12:30:00"
},
{
"duration": 1227600,
"end": "2019-10-25T17:30:00",
"event": "JPMorgan Chase Software Engineer Diversity Hiring Challenge",
"href": "https://www.hackerearth.com/challenges/hiring/jpmc-se-2019/",
"id": 16139007,
"resource": {"id": 73, "name": "hackerearth.com"},
"start": "2019-10-11T12:30:00"
},
{
"duration": 118500,
"end": "2019-10-20T12:25:00",
"event": "JLL IDEAS",
"href": "https://jll.hackerearth.com/",
"id": 15834119,
"resource": {"id": 73, "name": "hackerearth.com"},
"start": "2019-10-19T03:30:00"
},
{
"duration": 7200,
"end": "2019-10-17T15:35:00",
"event": "Codeforces Round #593 (Div. 2)",
"href": "http://codeforces.com/contests/1236",
"id": 16153154,
"resource": {"id": 1, "name": "codeforces.com"},
"start": "2019-10-17T13:35:00"
},
{
"duration": 10800,
"end": "2019-11-09T17:30:00",
"event": "IEM Coding Olympiad (IEMCO)",
"href":
"http://www.codechef.com/IEMCO8?utm_source=contest_listing&utm_medium=link&utm_campaign=IEMCO8",
"id": 16170811,
"resource": {"id": 2, "name": "codechef.com"},
"start": "2019-11-09T14:30:00"
},
{
"duration": 18000,
"end": "2019-10-13T13:00:00",
"event": "Grand Prix of Korea",
"href":
"http://opencup.ru/index.cgi?data=ock/schedule&menu=index&head=index",
"id": 16184737,
"resource": {"id": 6, "name": "opencup.ru"},
"start": "2019-10-13T08:00:00"
},
{
"duration": 18000,
"end": "2019-10-20T13:00:00",
"event": "Grand Prix of Southern Europe",
"href":
"http://opencup.ru/index.cgi?data=ock/schedule&menu=index&head=index",
"id": 16184738,
"resource": {"id": 6, "name": "opencup.ru"},
"start": "2019-10-20T08:00:00"
},
{
"duration": 864000,
"end": "2019-11-11T09:30:00",
"event": "November Challenge 2019",
"href":
"http://www.codechef.com/NOV19?utm_source=contest_listing&utm_medium=link&utm_campaign=NOV19",
"id": 13671215,
"resource": {"id": 2, "name": "codechef.com"},
"start": "2019-11-01T09:30:00"
},
{
"duration": 10800,
"end": "2019-10-26T17:00:00",
"event": "October Lunchtime 2019",
"href":
"http://www.codechef.com/LTIME77?utm_source=contest_listing&utm_medium=link&utm_campaign=LTIME77",
"id": 13670990,
"resource": {"id": 2, "name": "codechef.com"},
"start": "2019-10-26T14:00:00"
},
{
"duration": 18000,
"end": "2019-10-13T11:00:00",
"event": "Программирование - профессионалы (ком. 2019)",
"href": "http://dl.gsu.by/LC.jsp?Type=-1&lng=ru",
"id": 14933773,
"resource": {"id": 4, "name": "dl.gsu.by"},
"start": "2019-10-13T06:00:00"
},
{
"duration": 10800,
"end": "2019-12-28T17:00:00",
"event": "December Lunchtime 2019",
"href": "https://www.codechef.com/LTIME79",
"id": 13671217,
"resource": {"id": 2, "name": "codechef.com"},
"start": "2019-12-28T14:00:00"
},
{
"duration": 21600,
"end": "2019-10-20T11:00:00",
"event": "Программирование - профессионалы (лич. 2019-2020)",
"href": "http://dl.gsu.by/LC.jsp?Type=-1&lng=ru",
"id": 15650496,
"resource": {"id": 4, "name": "dl.gsu.by"},
"start": "2019-10-20T05:00:00"
},
{
"duration": 14400,
"end": "2019-10-18T18:00:00",
"event": "ICPC for Schools 2019",
"href":
"http://www.codechef.com/ICPCSC19?utm_source=contest_listing&utm_medium=link&utm_campaign=ICPCSC19",
"id": 16191818,
"resource": {"id": 2, "name": "codechef.com"},
"start": "2019-10-18T14:00:00"
},
{
"duration": 172800,
"end": "2019-12-14T21:00:00",
"event": "PlaidCTF 2019",
"href": "https://ctftime.org/event/729/",
"id": 13308656,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2019-12-12T21:00:00"
},
{
"duration": 21600,
"end": "2019-11-10T11:00:00",
"event": "Программирование - профессионалы (лич. 2019-2020)",
"href": "http://dl.gsu.by/LC.jsp?Type=-1&lng=ru",
"id": 15650502,
"resource": {"id": 4, "name": "dl.gsu.by"},
"start": "2019-11-10T05:00:00"
},
{
"duration": 18000,
"end": "2019-11-10T11:00:00",
"event": "Программирование - профессионалы (ком. 2019)",
"href": "http://dl.gsu.by/LC.jsp?Type=-1&lng=ru",
"id": 15073415,
"resource": {"id": 4, "name": "dl.gsu.by"},
"start": "2019-11-10T06:00:00"
},
{
"duration": 7200,
"end": "2019-10-19T13:00:00",
"event": "SRM 769",
"href": "https://topcoder.com/community/events/",
"id": 15456983,
"resource": {"id": 12, "name": "topcoder.com"},
"start": "2019-10-19T11:00:00"
},
{
"duration": 7200,
"end": "2019-11-27T18:00:00",
"event": "SRM 771",
"href": "https://topcoder.com/community/events/",
"id": 15456985,
"resource": {"id": 12, "name": "topcoder.com"},
"start": "2019-11-27T16:00:00"
},
{
"duration": 104400,
"end": "2019-12-22T07:00:00",
"event": "SECCON 2019 Final International competition",
"href": "https://ctftime.org/event/801/",
"id": 14569468,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2019-12-21T02:00:00"
},
{
"duration": 10800,
"end": "2019-10-19T16:30:00",
"event": "Kick Start Round G",
"href":
"https://codingcompetitions.withgoogle.com/kickstart/round/0000000000050e02",
"id": 13898981,
"resource": {"id": 35, "name": "codingcompetitions.withgoogle.com"},
"start": "2019-10-19T13:30:00"
},
{
"duration": 9000,
"end": "2019-10-16T17:05:00",
"event": "Codeforces Global Round 5",
"href": "http://codeforces.com/contests/1237",
"id": 16195485,
"resource": {"id": 1, "name": "codeforces.com"},
"start": "2019-10-16T14:35:00"
},
{
"duration": 86400,
"end": "2019-10-27T21:00:00",
"event": "BackdoorCTF 2019",
"href": "https://ctftime.org/event/850/",
"id": 15653149,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2019-10-26T21:00:00"
},
{
"duration": 194100,
"end": "2019-10-20T18:25:00",
"event": "ThoughtWorks UI Developer hiring challenge - October 2019",
"href":
"https://www.hackerearth.com/challenges/hiring/thoughtworks-ui-developer-hiring-challenge-october-2019/",
"id": 16200726,
"resource": {"id": 73, "name": "hackerearth.com"},
"start": "2019-10-18T12:30:00"
},
{
"duration": 5400,
"end": "2019-10-12T05:30:00",
"event": "Data Structures and Algorithms coding contest #3",
"href":
"https://www.hackerearth.com/challenges/competitive/data-structures-and-algorithms-coding-challenge-3/",
"id": 16200935,
"resource": {"id": 73, "name": "hackerearth.com"},
"start": "2019-10-12T04:00:00"
},
{
"duration": 604800,
"end": "2019-10-26T15:30:00",
"event": "October Circuits '19",
"href":
"https://www.hackerearth.com/challenges/competitive/october-circuits-19/",
"id": 16211428,
"resource": {"id": 73, "name": "hackerearth.com"},
"start": "2019-10-19T15:30:00"
},
{
"duration": 2595600,
"end": "2019-11-13T14:00:00",
"event": "CDC Text Classification Marathon",
"href":
"https://topcoder.com/longcontest/?module=ViewProblemStatement&rd=17708&pm=15724",
"id": 16229906,
"resource": {"id": 12, "name": "topcoder.com"},
"start": "2019-10-14T13:00:00"
},
{
"duration": 131400,
"end": "2019-11-10T15:30:00",
"event": "RAKATHON 2.0",
"href": "https://www.hackerearth.com/challenges/hackathon/rakathon-v2/",
"id": 16213972,
"resource": {"id": 73, "name": "hackerearth.com"},
"start": "2019-11-09T03:00:00"
},
{
"duration": 9000,
"end": "2019-10-11T16:30:00",
"event": "Exun Programming Prelims 2019 (Rated for all)",
"href":
"http://www.codechef.com/EXPP2019?utm_source=contest_listing&utm_medium=link&utm_campaign=EXPP2019",
"id": 16213126,
"resource": {"id": 2, "name": "codechef.com"},
"start": "2019-10-11T14:00:00"
},
{
"duration": 7200,
"end": "2019-10-20T11:05:00",
"event": "Codeforces Round #594 (Div. TBA)",
"href": "http://codeforces.com/contests/1239",
"id": 16233867,
"resource": {"id": 1, "name": "codeforces.com"},
"start": "2019-10-20T09:05:00"
},
{
"duration": 18000,
"end": "2019-11-03T11:00:00",
"event": "Программирование - профессионалы (ком. 2019)",
"href": "http://dl.gsu.by/LC.jsp?Type=-1&lng=ru",
"id": 15073414,
"resource": {"id": 4, "name": "dl.gsu.by"},
"start": "2019-11-03T06:00:00"
},
{
"duration": 21600,
"end": "2019-11-24T11:00:00",
"event": "Программирование - профессионалы (лич. 2019-2020)",
"href": "http://dl.gsu.by/LC.jsp?Type=-1&lng=ru",
"id": 15727016,
"resource": {"id": 4, "name": "dl.gsu.by"},
"start": "2019-11-24T05:00:00"
},
{
"duration": 539700,
"end": "2019-11-03T18:25:00",
"event": "Shuttl - Backend Hiring",
"href":
"https://www.hackerearth.com/challenges/hiring/shuttl-backend-hiring-2019/",
"id": 16243263,
"resource": {"id": 73, "name": "hackerearth.com"},
"start": "2019-10-28T12:30:00"
},
{
"duration": 7200,
"end": "2019-11-06T17:05:00",
"event": "Codeforces Round #597 (Div. 1)",
"href": "http://codeforces.com/contests/1242",
"id": 16243745,
"resource": {"id": 1, "name": "codeforces.com"},
"start": "2019-11-06T15:05:00"
},
{
"duration": 7200,
"end": "2019-11-06T17:05:00",
"event": "Codeforces Round #597 (Div. 2)",
"href": "http://codeforces.com/contests/1243",
"id": 16243746,
"resource": {"id": 1, "name": "codeforces.com"},
"start": "2019-11-06T15:05:00"
},
{
"duration": 864000,
"end": "2019-12-16T09:30:00",
"event": "December Challenge 2019",
"href": "https://www.codechef.com/DEC19",
"id": 13671218,
"resource": {"id": 2, "name": "codechef.com"},
"start": "2019-12-06T09:30:00"
},
{
"duration": 21600,
"end": "2019-11-03T11:00:00",
"event": "Программирование - профессионалы (лич. 2019-2020)",
"href": "http://dl.gsu.by/LC.jsp?Type=-1&lng=ru",
"id": 15650500,
"resource": {"id": 4, "name": "dl.gsu.by"},
"start": "2019-11-03T05:00:00"
},
{
"duration": 7200,
"end": "2019-10-13T11:05:00",
"event": "Codeforces Round #592 (Div. 2)",
"href": "http://codeforces.com/contests/1244",
"id": 16251090,
"resource": {"id": 1, "name": "codeforces.com"},
"start": "2019-10-13T09:05:00"
},
{
"duration": 37800,
"end": "2019-10-12T23:00:00",
"event": "Wawa HCL Hackathon 2019",
"href":
"https://www.hackerearth.com/challenges/hackathon/wawa-hcl-hackathon/",
"id": 15861217,
"resource": {"id": 73, "name": "hackerearth.com"},
"start": "2019-10-12T12:30:00"
},
{
"duration": 7200,
"end": "2019-11-01T16:35:00",
"event": "Codeforces Round #596 (Div. 2)",
"href": "http://codeforces.com/contests/1245",
"id": 16255643,
"resource": {"id": 1, "name": "codeforces.com"},
"start": "2019-11-01T14:35:00"
},
{
"duration": 7200,
"end": "2019-10-26T13:05:00",
"event":
"Codeforces Round #595 (Div. 1, based on Technocup 2020 Elimination Round 2)",
"href": "http://codeforces.com/contests/1246",
"id": 16262418,
"resource": {"id": 1, "name": "codeforces.com"},
"start": "2019-10-26T11:05:00"
},
{
"duration": 7200,
"end": "2019-10-26T13:05:00",
"event":
"Codeforces Round #595 (Div. 2, based on Technocup 2020 Elimination Round 2)",
"href": "http://codeforces.com/contests/1247",
"id": 16262855,
"resource": {"id": 1, "name": "codeforces.com"},
"start": "2019-10-26T11:05:00"
},
{
"duration": 0,
"end": "2019-10-19T15:00:00",
"event": "Problem 684",
"href": "https://projecteuler.net/news",
"id": 16261019,
"resource": {"id": 65, "name": "projecteuler.net"},
"start": "2019-10-19T15:00:00"
},
{
"duration": 0,
"end": "2019-10-19T15:00:00",
"event": "Problem 685",
"href": "https://projecteuler.net/news",
"id": 16261233,
"resource": {"id": 65, "name": "projecteuler.net"},
"start": "2019-10-19T15:00:00"
},
{
"duration": 0,
"end": "2019-10-26T18:00:00",
"event": "Problem 686",
"href": "https://projecteuler.net/news",
"id": 16261234,
"resource": {"id": 65, "name": "projecteuler.net"},
"start": "2019-10-26T18:00:00"
},
{
"duration": 0,
"end": "2019-11-02T22:00:00",
"event": "Problem 687",
"href": "https://projecteuler.net/news",
"id": 16261235,
"resource": {"id": 65, "name": "projecteuler.net"},
"start": "2019-11-02T22:00:00"
},
{
"duration": 0,
"end": "2019-11-24T08:00:00",
"event": "Problem 690",
"href": "https://projecteuler.net/news",
"id": 16261238,
"resource": {"id": 65, "name": "projecteuler.net"},
"start": "2019-11-24T08:00:00"
},
{
"duration": 9000,
"end": "2019-10-11T18:00:00",
"event": "Code_Farrago",
"href":
"http://www.codechef.com/COFO2019?utm_source=contest_listing&utm_medium=link&utm_campaign=COFO2019",
"id": 16254088,
"resource": {"id": 2, "name": "codechef.com"},
"start": "2019-10-11T15:30:00"
},
{
"duration": 7200,
"end": "2019-10-11T14:20:00",
"event": "yukicoder contest 227",
"href": "http://yukicoder.me/contests/239",
"id": 16262185,
"resource": {"id": 109, "name": "yukicoder.me"},
"start": "2019-10-11T12:20:00"
},
{
"duration": 0,
"end": "2019-11-10T01:00:00",
"event": "Problem 688",
"href": "https://projecteuler.net/news",
"id": 16261236,
"resource": {"id": 65, "name": "projecteuler.net"},
"start": "2019-11-10T01:00:00"
},
{
"duration": 0,
"end": "2019-11-17T04:00:00",
"event": "Problem 689",
"href": "https://projecteuler.net/news",
"id": 16261237,
"resource": {"id": 65, "name": "projecteuler.net"},
"start": "2019-11-17T04:00:00"
},
{
"duration": 172800,
"end": "2019-12-01T23:00:00",
"event": "TUCTF 2019",
"href": "https://ctftime.org/event/829/",
"id": 15115751,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2019-11-29T23:00:00"
},
{
"duration": 18000,
"end": "2019-10-13T13:00:00",
"event": "Вторая командная олимпиада",
"href": "http://acmp.ru/asp/champ/index.asp?main=stage_info&id_stage=41348",
"id": 16258792,
"resource": {"id": 5, "name": "acmp.ru"},
"start": "2019-10-13T08:00:00"
},
{
"duration": 86400,
"end": "2019-12-29T07:00:00",
"event": "#kksctf open 2019",
"href": "https://ctftime.org/event/874/",
"id": 16271692,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2019-12-28T07:00:00"
},
{
"duration": 32400,
"end": "2019-11-23T19:00:00",
"event": "RuCTFE 2019",
"href": "https://ctftime.org/event/906/",
"id": 16271700,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2019-11-23T10:00:00"
},
{
"duration": 129600,
"end": "2019-12-01T21:00:00",
"event": "CTFZone 2019 Quals",
"href": "https://ctftime.org/event/894/",
"id": 16271698,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2019-11-30T09:00:00"
},
{
"duration": 86400,
"end": "2019-10-13T12:30:00",
"event": "CryptixCTF'19",
"href": "https://ctftime.org/event/890/",
"id": 16271709,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2019-10-12T12:30:00"
},
{
"duration": 172800,
"end": "2019-10-14T02:00:00",
"event": "HITCON CTF 2019 Quals",
"href": "https://ctftime.org/event/848/",
"id": 16271713,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2019-10-12T02:00:00"
},
{
"duration": 1800,
"end": "2019-10-13T15:00:00",
"event": "ketek[i] QuickMatch 16",
"href":
"http://www.codechef.com/QM162019?utm_source=contest_listing&utm_medium=link&utm_campaign=QM162019",
"id": 16254085,
"resource": {"id": 2, "name": "codechef.com"},
"start": "2019-10-13T14:30:00"
},
{
"duration": 19800,
"end": "2019-11-30T19:00:00",
"event": "m0leCon CTF 2019",
"href": "https://ctftime.org/event/905/",
"id": 16271697,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2019-11-30T13:30:00"
},
{
"duration": 108000,
"end": "2019-11-15T15:00:00",
"event": "Dragon CTF 2019",
"href": "https://ctftime.org/event/887/",
"id": 16271702,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2019-11-14T09:00:00"
},
{
"duration": 129600,
"end": "2019-10-13T22:00:00",
"event": "RoarCTF 2019",
"href": "https://ctftime.org/event/878/",
"id": 16271712,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2019-10-12T10:00:00"
},
{
"duration": 86400,
"end": "2019-12-06T12:30:00",
"event": "1st IHS CTF",
"href": "https://ctftime.org/event/902/",
"id": 16271696,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2019-12-05T12:30:00"
},
{
"duration": 86400,
"end": "2019-10-12T19:30:00",
"event": "Reply Cyber Security Challenge",
"href": "https://ctftime.org/event/888/",
"id": 16271714,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2019-10-11T19:30:00"
},
{
"duration": 10800,
"end": "2019-11-30T17:00:00",
"event": "November Lunchtime 2019",
"href": "https://www.codechef.com/LTIME78",
"id": 13671213,
"resource": {"id": 2, "name": "codechef.com"},
"start": "2019-11-30T14:00:00"
},
{
"duration": 52200,
"end": "2019-11-18T06:30:00",
"event": "November Cook-Off 2019",
"href": "https://www.codechef.com/COOK112",
"id": 13671214,
"resource": {"id": 2, "name": "codechef.com"},
"start": "2019-11-17T16:00:00"
},
{
"duration": 72000,
"end": "2020-03-07T05:00:00",
"event": "UCSB iCTF 2020",
"href": "https://ctftime.org/event/899/",
"id": 16271691,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2020-03-06T09:00:00"
},
{
"duration": 172800,
"end": "2019-12-15T19:00:00",
"event": "watevrCTF 2019",
"href": "https://ctftime.org/event/893/",
"id": 16271694,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2019-12-13T19:00:00"
},
{
"duration": 216000,
"end": "2019-11-18T05:00:00",
"event": "RITSEC CTF 2019",
"href": "https://ctftime.org/event/898/",
"id": 16271701,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2019-11-15T17:00:00"
},
{
"duration": 36000,
"end": "2019-11-01T12:00:00",
"event": "SibirCTF",
"href": "https://ctftime.org/event/889/",
"id": 16271706,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2019-11-01T02:00:00"
},
{
"duration": 86400,
"end": "2019-10-27T12:00:00",
"event": "TastelessCTF 2019",
"href": "https://ctftime.org/event/872/",
"id": 16271707,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2019-10-26T12:00:00"
},
{
"duration": 21600,
"end": "2019-10-19T08:00:00",
"event": "Hong Kong CTF Open 2019 Finals",
"href": "https://ctftime.org/event/860/",
"id": 16271708,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2019-10-19T02:00:00"
},
{
"duration": 129600,
"end": "2019-10-13T22:00:00",
"event": "RoarCTF 2019",
"href": "https://ctftime.org/event/875/",
"id": 16271710,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2019-10-12T10:00:00"
},
{
"duration": 86400,
"end": "2019-10-13T10:00:00",
"event": "M*CTF 2019 Quals",
"href": "https://ctftime.org/event/876/",
"id": 16271711,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2019-10-12T10:00:00"
},
{
"duration": 115200,
"end": "2019-12-08T09:00:00",
"event": "Real World CTF 2019 Finals",
"href": "https://ctftime.org/event/857/",
"id": 16271695,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2019-12-07T01:00:00"
},
{
"duration": 64800,
"end": "2019-11-24T08:00:00",
"event": "Trend Micro CTF 2019 - Raimund Genes Cup - The Final",
"href": "https://ctftime.org/event/907/",
"id": 16271699,
"resource": {"id": 70, "name": "ctftime.org"},
"start": "2019-11-23T14:00:00"
}
];
| 0 |
mirrored_repositories/Hackathon-Tom/lib | mirrored_repositories/Hackathon-Tom/lib/screens/screen1.dart | import 'package:flutter/material.dart';
import 'package:future_hacks/utilities/hacks.dart';
import 'package:flutter_web_browser/flutter_web_browser.dart';
class Screen1 extends StatefulWidget {
static const routeName = 'Screen1';
@override
_Screen1State createState() => _Screen1State();
}
class _Screen1State extends State<Screen1> {
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
appBar: AppBar(
title: Text('HackaTom'),
centerTitle: true,
automaticallyImplyLeading: false,
actions: <Widget>[
Icon(Icons.account_circle),
],
backgroundColor: Colors.black,
),
body: ListView.builder(
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
FlutterWebBrowser.openWebPage(
url: hacks[index]['href'],
androidToolbarColor: Colors.indigo,
);
},
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Card(
elevation: 6.0,
child: ListTile(
title: Text(
hacks[index]['event'],
style: TextStyle(
fontSize: 24.0,
fontWeight: FontWeight.w500,
),
),
subtitle: Text(
'Start: ' +
hacks[index]['start'] +
'\nEnd: ' +
hacks[index]['end'],
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.w300,
),
),
trailing: Icon(
Icons.play_arrow,
size: 45.0,
),
isThreeLine: true,
),
),
),
);
},
),
),
);
}
}
| 0 |
mirrored_repositories/todoApp | mirrored_repositories/todoApp/lib/main.dart | import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:todoing/models/task_data.dart';
import 'package:todoing/screens/tasks_screen.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return ChangeNotifierProvider(
builder: (context)=> TaskData(),
child: MaterialApp(
home: TasksScreen(),
),
);
}
} | 0 |
mirrored_repositories/todoApp/lib | mirrored_repositories/todoApp/lib/widgets/task_tile.dart | import 'package:flutter/material.dart';
class TaskTile extends StatelessWidget {
final bool isChecked;
final String taskTitle;
final Function checkboxCallback;
final Function longPressCallback;
TaskTile({this.isChecked, this.taskTitle, this.checkboxCallback, this.longPressCallback});
@override
Widget build(BuildContext context) {
return ListTile(
onLongPress: longPressCallback,
title: Text(taskTitle,
style: TextStyle(
decoration: isChecked ? TextDecoration.lineThrough : null,
),
),
trailing:Checkbox(
activeColor: Colors.lightBlueAccent,
value: isChecked,
onChanged: checkboxCallback
),
);
}
}
| 0 |
mirrored_repositories/todoApp/lib | mirrored_repositories/todoApp/lib/widgets/task_list.dart | import 'package:flutter/material.dart';
import 'package:todoing/widgets/task_tile.dart';
import 'package:provider/provider.dart';
import 'package:todoing/models/task_data.dart';
class TaskList extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Consumer<TaskData>(
builder: (context, taskData, child){
return ListView.builder(itemBuilder: (context, index){
final task = taskData.tasks[index];
return TaskTile(
taskTitle: task.name,
isChecked: task.isDone,
checkboxCallback: (checkState) {
taskData.updateTask(task);
},
longPressCallback: (){
taskData.deleteTask(task);
},
);
},
itemCount: taskData.taskCount,
);
}
);
}
} | 0 |
mirrored_repositories/todoApp/lib | mirrored_repositories/todoApp/lib/models/task.dart | class Task {
final String name;
bool isDone;
Task({this.name, this.isDone = false});
void toggleDone(){
isDone = !isDone;
}
} | 0 |
mirrored_repositories/todoApp/lib | mirrored_repositories/todoApp/lib/models/task_data.dart | import 'package:flutter/foundation.dart';
import 'package:todoing/models/task.dart';
import 'dart:collection';
class TaskData extends ChangeNotifier {
List<Task> _tasks = [];
int get taskCount{
return _tasks.length;
}
UnmodifiableListView <Task> get tasks {
return UnmodifiableListView(_tasks);
}
void updateTask (Task task){
task.toggleDone();
notifyListeners();
}
void addTask(String newTaskTitle){
final task = Task(name: newTaskTitle);
_tasks.add(task);
notifyListeners();
}
void deleteTask(Task task){
_tasks.remove(task);
notifyListeners();
}
}
| 0 |
mirrored_repositories/todoApp/lib | mirrored_repositories/todoApp/lib/screens/add_task_sreen.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:todoing/models/task_data.dart';
class AddTaskScreen extends StatefulWidget {
@override
_AddTaskScreenState createState() => _AddTaskScreenState();
}
class _AddTaskScreenState extends State<AddTaskScreen> {
@override
Widget build(BuildContext context) {
String newTaskTitle;
return Container(
color: Color(0xff757575),
child: Container(
padding: EdgeInsets.only(left: 40.0, right: 40.0, top: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topRight: Radius.circular(20.0),
topLeft: Radius.circular(20.0)
)
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Text('Add Task',
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.lightBlueAccent,
fontSize: 20.0,
fontWeight: FontWeight.w500
),
),
TextField(
textAlign: TextAlign.center,
onChanged: (newText) {
newTaskTitle = newText;
},
textInputAction: TextInputAction.done,
),
FlatButton(
child: Text('Add',
style: TextStyle(
color: Colors.white
),
),
color: Colors.lightBlueAccent,
onPressed:(){
Provider.of<TaskData>(context).addTask(newTaskTitle);
Navigator.pop(context);
},
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/todoApp/lib | mirrored_repositories/todoApp/lib/screens/tasks_screen.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:todoing/widgets/task_list.dart';
import 'package:todoing/screens/add_task_sreen.dart';
import 'package:provider/provider.dart';
import 'package:todoing/models/task_data.dart';
class TasksScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.lightBlueAccent,
floatingActionButton: FloatingActionButton(
onPressed: (){
showModalBottomSheet(
context: context,
builder:(context)=>
AddTaskScreen()
);
},
backgroundColor: Colors.lightBlueAccent,
child: Icon(Icons.add),
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
padding: EdgeInsets.only(top: 60.0, left: 30.0, right: 30.0, bottom: 30.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
CircleAvatar(
child: Icon(Icons.list,
size: 30.0,
color: Colors.lightBlueAccent,
),
backgroundColor: Colors.white,
radius: 30.0,
),
SizedBox(
height: 10.0,
),
Text('DooList',
style: TextStyle(
color: Colors.white,
fontSize: 40.0, fontWeight: FontWeight.w500),
),
Text('${Provider.of<TaskData>(context).taskCount} Tasks',
style: TextStyle(
color: Colors.white,
fontSize: 18
),
),
],
),
),
Expanded(
child: Container(
padding: EdgeInsets.symmetric(horizontal: 20.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20.0),
topRight: Radius.circular(20.0)
)
),
child: TaskList(),
),
)
],
),
);
}
}
| 0 |
mirrored_repositories/todoApp | mirrored_repositories/todoApp/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:todoing/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
| 0 |
mirrored_repositories/login_sign_up_app | mirrored_repositories/login_sign_up_app/lib/loginscreen.dart | import 'package:flutter/material.dart';
class loginscreen extends StatelessWidget {
const loginscreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: [
Container(
height: double.infinity,
width: double.infinity,
decoration: const BoxDecoration(
gradient: LinearGradient(
colors: [
Color(0xffB81736),
Color(0xff281537),
],
),
),
child: const Padding(
padding: EdgeInsets.only(
top: 60.0,
left: 22,
),
child: Text(
'Hy \n Sign In',
style: TextStyle(
fontSize: 30,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
),
Padding(
padding: const EdgeInsets.only(top: 200.0),
child: Container(
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(40),
topRight: Radius.circular(40),
),
color: Colors.white,
),
child: Padding(
padding: const EdgeInsets.only(
right: 18.0,
left: 18,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const TextField(
decoration: InputDecoration(
suffixIcon: Icon(
Icons.check,
color: Colors.grey,
),
label: Text(
'Gmail',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Color(0xffB81736),
),
),
),
),
const TextField(
decoration: InputDecoration(
suffixIcon: Icon(
Icons.visibility_off,
color: Colors.grey,
),
label: Text(
'Password',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Color(0xffB81736),
),
),
),
),
const SizedBox(
height: 20,
),
const Align(
alignment: Alignment.centerRight,
child: Text(
'Forget Password?',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 17,
color: Color(0xff281537),
),
),
),
const SizedBox(
height: 20,
),
Container(
height: 60,
width: 300,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
gradient: const LinearGradient(
colors: [
Color(0xffB81736),
Color(0xff281537),
],
),
),
child: const Center(
child: Text(
'SIGN IN',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20,
color: Colors.white),
),
),
),
const SizedBox(
height: 150,
),
const Align(
alignment: Alignment.bottomRight,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
"Don't have account?",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.grey),
),
Text(
"Sign up",
style: TextStyle(
///done login page
fontWeight: FontWeight.bold,
fontSize: 17,
color: Colors.black),
),
],
),
),
],
),
),
),
),
],
),
);
}
}
| 0 |
mirrored_repositories/login_sign_up_app | mirrored_repositories/login_sign_up_app/lib/main.dart | import 'package:flutter/material.dart';
import 'WecmeScreen.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
fontFamily: ('inter'),
useMaterial3: true,
),
home: const WecmeScreen(),
);
}
}
| 0 |
mirrored_repositories/login_sign_up_app | mirrored_repositories/login_sign_up_app/lib/regscreen.dart | import 'package:flutter/material.dart';
class regScreen extends StatelessWidget {
const regScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
//thanks for watching
children: [
Container(
height: double.infinity,
width: double.infinity,
decoration: const BoxDecoration(
gradient: LinearGradient(colors: [
Color(0xffB81736),
Color(0xff281537),
]),
),
child: const Padding(
padding: EdgeInsets.only(top: 60.0, left: 22),
child: Text(
'Create Your\nAccount',
style: TextStyle(
fontSize: 30,
color: Colors.white,
fontWeight: FontWeight.bold),
),
),
),
Padding(
padding: const EdgeInsets.only(top: 200.0),
child: Container(
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(40), topRight: Radius.circular(40)),
color: Colors.white,
),
height: double.infinity,
width: double.infinity,
child: Padding(
padding: const EdgeInsets.only(left: 18.0, right: 18),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const TextField(
decoration: InputDecoration(
suffixIcon: Icon(
Icons.check,
color: Colors.grey,
),
label: Text(
'Full Name',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Color(0xffB81736),
),
)),
),
const TextField(
decoration: InputDecoration(
suffixIcon: Icon(
Icons.check,
color: Colors.grey,
),
label: Text(
'Phone or Gmail',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Color(0xffB81736),
),
)),
),
const TextField(
decoration: InputDecoration(
suffixIcon: Icon(
Icons.visibility_off,
color: Colors.grey,
),
label: Text(
'Password',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Color(0xffB81736),
),
)),
),
const TextField(
decoration: InputDecoration(
suffixIcon: Icon(
Icons.visibility_off,
color: Colors.grey,
),
label: Text(
'Conform Password',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Color(0xffB81736),
),
)),
),
const SizedBox(
height: 10,
),
const SizedBox(
height: 70,
),
Container(
height: 55,
width: 300,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
gradient: const LinearGradient(colors: [
Color(0xffB81736),
Color(0xff281537),
]),
),
child: const Center(
child: Text(
'SIGN IN',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20,
color: Colors.white),
),
),
),
const SizedBox(
height: 80,
),
const Align(
alignment: Alignment.bottomRight,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
"Don't have account?",
style: TextStyle(
fontWeight: FontWeight.bold, color: Colors.grey),
),
Text(
"Sign up",
style: TextStyle(
///done login page
fontWeight: FontWeight.bold,
fontSize: 17,
color: Colors.black),
),
],
),
)
],
),
),
),
),
],
));
}
}
| 0 |
mirrored_repositories/login_sign_up_app | mirrored_repositories/login_sign_up_app/lib/WecmeScreen.dart | import 'package:flutter/material.dart';
import 'package:login_sign_up/loginscreen.dart';
import 'package:login_sign_up/regscreen.dart';
class WecmeScreen extends StatelessWidget {
const WecmeScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
height: double.infinity,
width: double.infinity,
decoration: const BoxDecoration(
gradient: LinearGradient(
colors: [
Color(0xffB81736),
Color(0xff281537),
],
),
),
child: Column(
children: [
const Padding(
padding: EdgeInsets.only(top: 200.0),
child: Image(
image: AssetImage('assets/logo.png'),
),
),
const SizedBox(
height: 100,
),
const Text(
'Welcome back',
style: TextStyle(fontSize: 30, color: Colors.white),
),
const SizedBox(
height: 30,
),
GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (Contxt) => loginscreen(),
),
);
},
child: Container(
height: 53,
width: 320,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
border: Border.all(color: Colors.white),
),
child: const Center(
child: Text(
'SiGN IN',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
),
),
),
const SizedBox(
height: 30,
),
GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (Contxt) => regScreen(),
),
);
},
child: Container(
height: 53,
width: 320,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(30),
border: Border.all(color: Colors.white),
),
child: const Center(
child: Text(
'SIGN UP',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
),
),
const Spacer(),
const Text(
'Login With Social Media',
style: TextStyle(
fontSize: 17,
color: Colors.white,
),
),
const SizedBox(
height: 12,
),
const Image(
image: AssetImage('assets/social.png'),
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/login_sign_up_app | mirrored_repositories/login_sign_up_app/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:login_sign_up/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
| 0 |
mirrored_repositories/PortfolioApp-Template | mirrored_repositories/PortfolioApp-Template/lib/main.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
// All the required libraries/packages for the project is imported
void main() {
// This the main function, only from here the code will be executed
runApp(MyApp()); // It is said to run the class MyApp
}
class MyApp extends StatelessWidget {
// StatelessWidget --> Helps the hot reload and restart to work
// Can use stless as a shortcut for obtaining the StatelessWidget
@override
Widget build(BuildContext context) {
return MaterialApp(
// MaterialApp is the one which has all the required materials for the app
home: Scaffold(
// It is a collection of various material designs available in flutter
backgroundColor: Colors.pinkAccent,
// Helps to have some color in the background
body: SafeArea(
// Mobile screens are different for different phones, So safe area helps to place the content only in the visible part
child: Column(
// It has many children // It arranges its children in vertical order
mainAxisAlignment: MainAxisAlignment.center,
// Arranges all the contents of the column to the centre
children: <Widget>[
// An array of container widgets
CircleAvatar(
// It gives some space for placing your image in a circle shape
maxRadius: 50.0,
backgroundColor: Colors.white,
backgroundImage: AssetImage(
'images/yourimage.jpg'), // It helps to use the image that was uploaded to the project
),
Text(
'Your Name', // ENTER
// It can have only have one thing inside it, eg., text but not text and image
style: TextStyle(
// Helps to style the text
fontFamily: 'Pacifico',
// Helps to use the fonts families that was uploaded in the project
fontSize: 40.0,
color: Colors.white,
),
),
Text(
'Your Role', //ENTER
style: TextStyle(
fontFamily: 'SourceSansPro',
fontSize: 18.0,
color: Colors.white,
letterSpacing: 2.5,
fontWeight: FontWeight.bold,
),
),
SizedBox(
// Leaves space between the containers
height: 10.0,
),
SizedBox(
height: 20.0,
width: 150.0,
child: Divider(
// Helps to draw lines between the containers
color: Colors.white,
thickness: 1.0,
),
),
Card(
// PHONE CARD USING LIST TILE
// It is an inbuilt widget which helps to draw cards with round edges and shadows
margin: EdgeInsets.symmetric(
vertical: 20.0,
horizontal: 30.0,
// Helps add some margin to the content
),
child: ListTile(
// It helps to add images and text inside the card
leading: Icon(
Icons.phone,
color: Colors.pink,
),
title: Text(
'+44 1234 5678', // ENTER
style: TextStyle(
fontSize: 17.0,
fontFamily: 'SourcesSansPro',
fontWeight: FontWeight.bold,
color: Colors.pink,
),
),
),
),
Card(
// EMAIL CARD USING LIST TILE
margin: EdgeInsets.symmetric(
vertical: 20.0,
horizontal: 30.0,
),
child: ListTile(
leading: Icon(
Icons.email,
color: Colors.pink,
),
title: Text(
'[email protected]', // ENTER
style: TextStyle(
fontSize: 17.0,
fontFamily: 'SourcesSansPro',
fontWeight: FontWeight.bold,
color: Colors.pink,
),
),
),
),
Center(
child: Text(
'LinkedIn, GitHub, Twitter', // ENTER
style: TextStyle(
fontFamily: 'SourceSansPro',
fontSize: 15.0,
color: Colors.white,
letterSpacing: 2.5,
fontWeight: FontWeight.bold,
),
),
),
Card(
// MEDIA CARD USING LIST TILE
margin: EdgeInsets.symmetric(
vertical: 20.0,
horizontal: 30.0,
),
child: ListTile(
leading: Icon(
Icons.forum,
color: Colors.pink,
),
title: Text(
'Your Social Account Ids', //ENTER
style: TextStyle(
fontSize: 17.0,
fontFamily: 'SourcesSansPro',
fontWeight: FontWeight.bold,
color: Colors.pink,
),
),
),
),
],
),
),
),
);
}
}
| 0 |
mirrored_repositories/PortfolioApp-Template | mirrored_repositories/PortfolioApp-Template/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:portfolioapp/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
| 0 |
mirrored_repositories/codeforces_contest | mirrored_repositories/codeforces_contest/lib/Splash.dart | import 'package:codeforces_contest/apiservices/cfapi.dart';
import 'package:codeforces_contest/helpers/loading.dart';
import 'package:codeforces_contest/main.dart';
import 'package:codeforces_contest/models/codeforcescontest.dart';
import 'package:flutter/material.dart';
import 'dart:async';
import 'helpers/DeviceSize.dart';
class SplashScreen extends StatefulWidget {
@override
_SplashScreenState createState() => _SplashScreenState();
}
class _SplashScreenState extends State<SplashScreen> {
@override
List<Result> ongoing=[];
List<Result> upcoming=[];
void initState() {
super.initState();
_mockCheckForSession().then((status) {
_navigateToHome();
});
}
Future<bool> _mockCheckForSession() async {
ongoing = await codeforcesApiServices().fetchOngoingContestList();
upcoming = await codeforcesApiServices().fetchUpcomingContestList();
return true;
}
void _navigateToHome() {
Navigator.of(context).pushReplacement(
MaterialPageRoute(builder: (BuildContext context) => home(ongoingContestList: ongoing,upcomingContestList: upcoming,)));
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
color: Colors. black,
constraints: BoxConstraints.expand(),
height: displayHeight(context),
width: displayWidth(context),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
RichText(
text: TextSpan(
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: displayWidth(context)*0.065,
fontFamily: 'Goldman',
),
children: [
TextSpan(text: 'CODEFORCES',style: TextStyle(
color: Colors.white,
)),
TextSpan(text: 'TIMER',style: TextStyle(
color: Colors.red,
)),
]
),
),
SizedBox(height: 20,),
Loading(),
],
),
),
),
);
}
}
| 0 |
mirrored_repositories/codeforces_contest | mirrored_repositories/codeforces_contest/lib/main.dart | import 'package:codeforces_contest/Splash.dart';
import 'package:codeforces_contest/apiservices/cfapi.dart';
import 'package:codeforces_contest/helpers/DeviceSize.dart';
import 'package:codeforces_contest/helpers/loading.dart';
import 'package:codeforces_contest/models/codeforcescontest.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:add_2_calendar/add_2_calendar.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
void main(){
runApp(MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: SplashScreen(),
);
}
}
class home extends StatefulWidget {
List<Result> upcomingContestList;
List<Result> ongoingContestList;
home({Key key,this.upcomingContestList,this.ongoingContestList}) : super(key: key);
@override
_homeState createState() => _homeState();
}
class _homeState extends State<home> {
bool isLoading = false;
@override
Widget build(BuildContext context) {
Event contestEvent (int durationInSeconds,DateTime dateTime,String title){
return Event(
title: title,
description: 'Coding contest',
location: 'Codeforces',
endDate: dateTime.add(Duration(seconds: durationInSeconds)),
startDate: dateTime,
);
}
Widget displayUpcomingContest(int index){
var date = DateTime.fromMillisecondsSinceEpoch(widget.upcomingContestList[index].startTimeSeconds * 1000);
String start = DateFormat.yMMMd()
.add_jm()
.format(DateTime.parse(date.toString()));
Color color = Color(0xfbf0f8ff);
return Container(
height: displayHeight(context)*0.1,
decoration: BoxDecoration(
color: color,
borderRadius: BorderRadius.circular(10),
boxShadow: [
BoxShadow(color: Colors.black87,offset: Offset(-3,1),blurRadius: 2),
]
),
child: SafeArea(
child: Stack(
alignment: Alignment.centerRight,
children: [
Positioned(
top: displayHeight(context)*0.02,
left: displayWidth(context)*0.03,
right: displayWidth(context)*0.35,
child: Text(
widget.upcomingContestList[index].name,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.w500,
fontSize: displayWidth(context)*0.0375,
color: Colors.black,
),
)),
Positioned(
bottom : displayHeight(context)*0.03,
left: displayWidth(context)*0.03,
right: displayWidth(context)*0.1,
child: Text(
start,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.w800,
fontSize: displayWidth(context)*0.0375,
color: Colors.black38,
),
)),
Positioned(
right: displayWidth(context)*0.04,
child: IconButton(
icon: Icon(Icons.alarm_add),
onPressed: (){
Add2Calendar.addEvent2Cal(
contestEvent(widget.upcomingContestList[index].durationSeconds,date, widget.upcomingContestList[index].name),
);
},
color: Colors.green,
),
),
],
),
),
);
}
Widget displayOngoingContest(int index){
var date = DateTime.fromMillisecondsSinceEpoch(widget.ongoingContestList[index].startTimeSeconds * 1000);
String start = DateFormat.yMMMd()
.add_jm()
.format(DateTime.parse(date.toString()));
Color color = Color(0xfbf0f8ff);
return Container(
height: displayHeight(context)*0.1,
decoration: BoxDecoration(
color: color,
borderRadius: BorderRadius.circular(10),
boxShadow: [
BoxShadow(color: Colors.black87,offset: Offset(-3,1),blurRadius: 2),
]
),
child: SafeArea(
child: Stack(
alignment: Alignment.centerRight,
children: [
Positioned(
top: displayHeight(context)*0.02,
left: displayWidth(context)*0.03,
right: displayWidth(context)*0.35,
child: Text(
widget.ongoingContestList[index].name,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.w500,
fontSize: displayWidth(context)*0.0375,
color: Colors.black,
),
)),
Positioned(
bottom : displayHeight(context)*0.03,
left: displayWidth(context)*0.03,
right: displayWidth(context)*0.1,
child: Text(
start,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.w800,
fontSize: displayWidth(context)*0.0375,
color: Colors.black38,
),
)),
],
),
),
);
}
return DefaultTabController(length: 2, child: Scaffold(
appBar: AppBar(
centerTitle: true,
backgroundColor: Colors.black,
leading: Image(image: AssetImage(
'images/cf.png',
),
fit: BoxFit.fitHeight,
),
title: RichText(
text: TextSpan(
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: displayWidth(context)*0.05,
fontFamily: 'Goldman',
),
children: [
TextSpan(text: 'CODEFORCES',style: TextStyle(
color: Colors.white,
)),
TextSpan(text: 'TIMER',style: TextStyle(
color: Colors.red,
)),
]
),
),
bottom: TabBar(
tabs: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('Ongoing',style: TextStyle(
color: Colors.white,
fontSize: displayWidth(context)*0.042,
),),
SizedBox(width: 8,),
Icon(Icons.play_circle_fill,color: Colors.green,),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('Upcoming',style: TextStyle(
color: Colors.white,
fontSize: displayWidth(context)*0.042,
),),
SizedBox(width: 8,),
Icon(Icons.pending_actions,color: Colors.pink,),
],
),
],
labelPadding: EdgeInsets.only(bottom: 13),
indicatorColor: Colors.white,
),
),
body: TabBarView(
children: [
// Ongoing contest
Container(
height: displayHeight(context),
width: displayWidth(context),
color: Colors.black,
child: widget.ongoingContestList.length!=0?Padding(
padding: const EdgeInsets.only(left: 15,right: 15,top: 20,bottom: 15),
child: ListView.builder(itemBuilder: (context,index){
return AnimationConfiguration.staggeredList(
position: index,
duration: const Duration(milliseconds: 380),
child: SlideAnimation(
verticalOffset: 50.0,
child:ScaleAnimation(
child: Padding(
padding: const EdgeInsets.only(bottom:15.0),
child: displayOngoingContest(index),
),
),
),
);
},
itemCount: widget.ongoingContestList.length,
),
):Center(
child: Text('No ongoing contests',style: TextStyle
(color: Colors.white,
fontSize: displayWidth(context)*0.04
),),
)
),
// Upcoming contests
Container(
height: displayHeight(context),
width: displayWidth(context),
color: Colors.black,
child: widget.upcomingContestList.length!=0?Padding(padding: EdgeInsets.only(left: 15,right: 15,top: 20,bottom: 15)
,child: ListView.builder(itemBuilder: (context,index){
return AnimationConfiguration.staggeredList(
position: index,
duration: const Duration(milliseconds: 400),
child: SlideAnimation(
verticalOffset: 50.0,
child: ScaleAnimation(
child: Padding(
padding: const EdgeInsets.only(bottom:15.0),
child: displayUpcomingContest(index),
),
),
),
);
},
itemCount: widget.upcomingContestList.length,
)
):Center(
child: Text('No Upcoming contests',style: TextStyle
(color: Colors.white,
fontSize: displayWidth(context)*0.04
),),
),
),
],
),
floatingActionButton: FloatingActionButton(
backgroundColor: Colors.red,
child: isLoading?Loading2():Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.api,color: Colors.white,size: displayWidth(context)*0.045,),
Text('Refresh',style: TextStyle(
fontSize: displayWidth(context)*0.024
),)
],
) ,
onPressed: ()async{
setState(() {
isLoading = true;
});
widget.upcomingContestList = await codeforcesApiServices().fetchUpcomingContestList();
widget.ongoingContestList = await codeforcesApiServices().fetchOngoingContestList();
// debugPrintStack(label: 'new list caught');
setState(() {
isLoading = false;
});
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content:
Text('Contest list has been successfully updated !!'),duration: Duration(seconds: 4),));
},
),
),
);
}
}
| 0 |
mirrored_repositories/codeforces_contest/lib | mirrored_repositories/codeforces_contest/lib/models/codeforcescontest.dart | class Codeforcescontest {
Codeforcescontest({
this.status,
this.result,
});
String status;
List<Result> result;
factory Codeforcescontest.fromJson(Map<String, dynamic> json) => Codeforcescontest(
status: json["status"],
result: List<Result>.from(json["result"].map((x) => Result.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"status": status,
"result": List<dynamic>.from(result.map((x) => x.toJson())),
};
}
class Result {
Result({
this.id,
this.name,
this.type,
this.phase,
this.frozen,
this.durationSeconds,
this.startTimeSeconds,
this.relativeTimeSeconds,
});
int id;
String name;
Type type;
Phase phase;
bool frozen;
int durationSeconds;
int startTimeSeconds;
int relativeTimeSeconds;
factory Result.fromJson(Map<String, dynamic> json) => Result(
id: json["id"],
name: json["name"],
type: typeValues.map[json["type"]],
phase: phaseValues.map[json["phase"]],
frozen: json["frozen"],
durationSeconds: json["durationSeconds"],
startTimeSeconds: json["startTimeSeconds"],
relativeTimeSeconds: json["relativeTimeSeconds"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"type": typeValues.reverse[type],
"phase": phaseValues.reverse[phase],
"frozen": frozen,
"durationSeconds": durationSeconds,
"startTimeSeconds": startTimeSeconds,
"relativeTimeSeconds": relativeTimeSeconds,
};
}
enum Phase { BEFORE, CODING, FINISHED, PENDING_SYSTEM_TEST }
final phaseValues = EnumValues({
"BEFORE": Phase.BEFORE,
"CODING": Phase.CODING,
"FINISHED": Phase.FINISHED,
"PENDING_SYSTEM_TEST": Phase.PENDING_SYSTEM_TEST
});
enum Type { CF, ICPC, IOI }
final typeValues = EnumValues({
"CF": Type.CF,
"ICPC": Type.ICPC,
"IOI": Type.IOI
});
class EnumValues<T> {
Map<String, T> map;
Map<T, String> reverseMap;
EnumValues(this.map);
Map<T, String> get reverse {
if (reverseMap == null) {
reverseMap = map.map((k, v) => new MapEntry(v, k));
}
return reverseMap;
}
}
| 0 |
mirrored_repositories/codeforces_contest/lib | mirrored_repositories/codeforces_contest/lib/helpers/DeviceSize.dart | import 'package:flutter/material.dart';
Size displaySize(BuildContext context) {
return MediaQuery.of(context).size;
}
double displayHeight(BuildContext context) {
return displaySize(context).height;
}
double displayWidth(BuildContext context) {
return displaySize(context).width;
}
| 0 |
mirrored_repositories/codeforces_contest/lib | mirrored_repositories/codeforces_contest/lib/helpers/loading.dart | import 'package:flutter/material.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'DeviceSize.dart';
class Loading extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
child: Center(
child: SpinKitHourGlass(
color: Colors.cyanAccent,
size: displayWidth(context) * 0.1,
),
),
);
}
}
class Loading2 extends StatelessWidget {
const Loading2({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
child: Center(
child: SpinKitCircle(
color: Colors.yellow[200],
size: displayWidth(context) * 0.1,
),
),
);
}
}
| 0 |
mirrored_repositories/codeforces_contest/lib | mirrored_repositories/codeforces_contest/lib/apiservices/cfapi.dart | import 'package:codeforces_contest/models/codeforcescontest.dart';
import 'package:flutter/material.dart';
import 'package:dio/dio.dart';
class codeforcesApiServices{
final String apiUrl = 'https://codeforces.com/api/contest.list';
Dio _dio;
codeforcesApiServices(){
_dio = Dio();
}
// Fetch ongoing contest list
Future<List<Result>> fetchOngoingContestList()async{
try{
Response response = await _dio.get(apiUrl);
Codeforcescontest contest = Codeforcescontest.fromJson(response.data);
return contest.result.where((element) => element.phase==Phase.CODING).toList().reversed.toList();
}
on DioError{
return null;
}
}
// Fetch upcoming contest list
Future<List<Result>> fetchUpcomingContestList()async{
try{
Response response = await _dio.get(apiUrl);
Codeforcescontest contest = Codeforcescontest.fromJson(response.data);
return contest.result.where((element) => element.phase==Phase.BEFORE).toList().reversed.toList();
}
on DioError{
return null;
}
}
} | 0 |
mirrored_repositories/codeforces_contest | mirrored_repositories/codeforces_contest/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:codeforces_contest/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
| 0 |
mirrored_repositories/ticketingApp_flutter | mirrored_repositories/ticketingApp_flutter/lib/main.dart | import 'package:flutter/material.dart';
import 'package:ticketing_app/screens/bottom_bar.dart';
import 'package:ticketing_app/utils/app_styles.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primaryColor: primary,
),
home: const BottomBar(),
);
}
}
| 0 |
mirrored_repositories/ticketingApp_flutter/lib | mirrored_repositories/ticketingApp_flutter/lib/widgets/double_text_widget.dart | import 'package:flutter/src/foundation/key.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/src/foundation/key.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/foundation/key.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:gap/gap.dart';
import 'package:ticketing_app/utils/app_layout.dart';
import '../utils/app_styles.dart';
class AppDoubleTextWidget extends StatelessWidget {
final String bigText;
final String smallText;
const AppDoubleTextWidget(
{Key? key, required this.bigText, required this.smallText})
: super(key: key);
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(bigText, style: Styles.headLineStyle2),
InkWell(
onTap: () {
print("You are tapped");
},
child: Text(smallText,
style: Styles.textStyle.copyWith(color: Styles.primaryColor)),
),
],
);
}
}
| 0 |
mirrored_repositories/ticketingApp_flutter/lib | mirrored_repositories/ticketingApp_flutter/lib/widgets/layout_builder_widget.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/foundation/key.dart';
import 'package:flutter/src/widgets/framework.dart';
class AppLayoutBuilderWidget extends StatelessWidget {
final bool? isColor;
final int sections;
final double width;
const AppLayoutBuilderWidget(
{Key? key, this.isColor, required this.sections, this.width = 3})
: super(key: key);
@override
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
print("The Width is ${constraints.constrainWidth()}");
return Flex(
direction: Axis.horizontal,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.max,
children: List.generate(
(constraints.constrainWidth() / sections).floor(),
(index) => SizedBox(
width: 3,
height: 1,
child: DecoratedBox(
decoration: BoxDecoration(
color: isColor == null
? Colors.white
: Colors.grey.shade300)),
)));
},
);
}
}
| 0 |
mirrored_repositories/ticketingApp_flutter/lib | mirrored_repositories/ticketingApp_flutter/lib/widgets/thick_container.dart | import 'package:flutter/src/foundation/key.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class ThickContainer extends StatelessWidget {
final bool? isColor;
const ThickContainer({Key? key, this.isColor}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(3.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
border: Border.all(
width: 2.5,
color: isColor == null ? Colors.white : Color(0xFF8ACCF7)),
),
);
}
}
| 0 |
mirrored_repositories/ticketingApp_flutter/lib | mirrored_repositories/ticketingApp_flutter/lib/widgets/column_layout.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/foundation/key.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:gap/gap.dart';
import '../utils/app_layout.dart';
import '../utils/app_styles.dart';
class AppColumnLayout extends StatelessWidget {
final String firstText;
final String secondText;
final bool? isColor;
final CrossAxisAlignment alignment;
const AppColumnLayout(
{Key? key,
required this.firstText,
required this.secondText,
required this.alignment,
this.isColor})
: super(key: key);
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: alignment,
children: [
Text(
firstText,
style: isColor == null
? Styles.headLineStyle3.copyWith(color: Colors.white)
: Styles.headLineStyle3,
),
Gap(AppLayout.getHeight(5)),
Text(
secondText,
style: isColor == null
? Styles.headLineStyle4.copyWith(color: Colors.white)
: Styles.headLineStyle4,
),
],
);
}
}
| 0 |
mirrored_repositories/ticketingApp_flutter/lib | mirrored_repositories/ticketingApp_flutter/lib/widgets/icon_text_widget.dart | import 'package:flutter/src/foundation/key.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/foundation/key.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:gap/gap.dart';
import 'package:ticketing_app/utils/app_layout.dart';
import '../utils/app_styles.dart';
class AppIconText extends StatelessWidget {
final IconData icon;
final String text;
const AppIconText({Key? key, required this.icon, required this.text})
: super(key: key);
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.symmetric(
vertical: AppLayout.getWidth(12), horizontal: AppLayout.getWidth(12)),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(AppLayout.getWidth(5))),
child: Row(
children: [
Icon(icon, color: Color(0xFFbFc2DF)),
Gap(AppLayout.getWidth(25)),
Text(
text,
style: Styles.textStyle,
)
],
),
);
}
}
| 0 |
mirrored_repositories/ticketingApp_flutter/lib | mirrored_repositories/ticketingApp_flutter/lib/widgets/ticket_tabs.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/foundation/key.dart';
import 'package:flutter/src/widgets/framework.dart';
import '../utils/app_layout.dart';
class AppTicketTabs extends StatelessWidget {
final String firstTab;
final String secondTab;
const AppTicketTabs(
{Key? key, required this.firstTab, required this.secondTab})
: super(key: key);
@override
Widget build(BuildContext context) {
final size = AppLayout.getSize(context);
return FittedBox(
child: Container(
padding: EdgeInsets.all(3.5),
child: Row(
children: [
//airline ticket section
Container(
width: size.width * .44,
padding: EdgeInsets.symmetric(vertical: AppLayout.getHeight(7)),
decoration: BoxDecoration(
borderRadius: BorderRadius.horizontal(
left: Radius.circular(AppLayout.getHeight(50))),
color: Colors.white,
),
child: Center(
child: Text(
firstTab,
),
),
),
//hotels section
Container(
width: size.width * .44,
padding: EdgeInsets.symmetric(vertical: AppLayout.getHeight(7)),
decoration: BoxDecoration(
borderRadius: BorderRadius.horizontal(
right: Radius.circular(AppLayout.getHeight(50))),
color: Colors.transparent,
),
child: Center(
child: Text(
secondTab,
),
),
),
],
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(AppLayout.getHeight(50)),
color: const Color(0xFFF4F6FD)),
),
);
}
}
| 0 |
mirrored_repositories/ticketingApp_flutter/lib | mirrored_repositories/ticketingApp_flutter/lib/utils/app_layout.dart | import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
class AppLayout {
static getSize(BuildContext context) => MediaQuery.of(context).size;
static getScreenheight() {
return Get.height;
}
static getScreenwidth() {
return Get.width;
}
static getHeight(double pixels) {
double x = getScreenheight() / pixels;
return getScreenheight() / x;
}
static getWidth(double pixels) {
double x = getScreenwidth() / pixels;
return getScreenwidth() / x;
}
}
| 0 |
mirrored_repositories/ticketingApp_flutter/lib | mirrored_repositories/ticketingApp_flutter/lib/utils/app_styles.dart | import 'package:flutter/material.dart';
Color primary = Color.fromARGB(255, 69, 91, 143);
class Styles {
static Color primaryColor = primary;
static Color textColor = const Color(0xFF3b3b3b);
static Color bgColor = const Color(0xFFeeedf2);
static Color orangeColor = const Color(0xFFF37B67);
static Color kakiColor = const Color(0xFFd2bdb6);
static TextStyle textStyle =
TextStyle(fontSize: 26, color: textColor, fontWeight: FontWeight.w500);
static TextStyle headLineStyle1 =
TextStyle(fontSize: 21, color: textColor, fontWeight: FontWeight.bold);
static TextStyle headLineStyle2 =
TextStyle(fontSize: 17, color: textColor, fontWeight: FontWeight.bold);
static TextStyle headLineStyle3 =
TextStyle(fontSize: 12, fontWeight: FontWeight.w600);
static TextStyle headLineStyle4 = TextStyle(
fontSize: 14, color: Colors.grey.shade500, fontWeight: FontWeight.w500);
}
| 0 |
mirrored_repositories/ticketingApp_flutter/lib | mirrored_repositories/ticketingApp_flutter/lib/utils/app_info_list.dart | List<Map<String, dynamic>> hotelList = [
{
'image': 'one.png',
'place': 'Open Space',
'destination': 'London',
'price': 25,
},
{
'image': 'two.png',
'place': 'Global Will',
'destination': 'London',
'price': 40,
},
{
'image': 'three.png',
'place': 'tallest Building',
'destination': 'Dubai',
'price': 68,
},
];
List<Map<String, dynamic>> ticketList = [
{
'from': {
'code': "NYC",
'name': "New York",
},
'to': {
'code': "LDN",
'name': "London",
},
'flying_time': '8H 30M',
'date': '1 May',
'departure_time': '08:00AM',
'number': 23
},
{
'from': {
'code': 'DK',
'name': 'Dhaka',
},
'to': {'code': 'SH', 'name': 'Shanghai'},
'flying_time': '4H 20M',
'date': '1 May',
'departure_time': '09:00AM',
'number': 45,
}
];
| 0 |
mirrored_repositories/ticketingApp_flutter/lib | mirrored_repositories/ticketingApp_flutter/lib/screens/ticket_view.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/foundation/key.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:gap/gap.dart';
import 'package:get/get.dart';
import 'package:ticketing_app/utils/app_layout.dart';
import 'package:ticketing_app/widgets/column_layout.dart';
import 'package:ticketing_app/widgets/layout_builder_widget.dart';
import 'package:ticketing_app/widgets/thick_container.dart';
import '../utils/app_styles.dart';
class TicketView extends StatelessWidget {
final Map<String, dynamic> ticket;
final bool? isColor;
const TicketView({Key? key, required this.ticket, this.isColor})
: super(key: key);
@override
Widget build(BuildContext context) {
final size = AppLayout.getSize(context);
return SizedBox(
width: size.width * 0.80,
height: AppLayout.getHeight(GetPlatform.isAndroid == true ? 167 : 163),
child: Container(
margin: EdgeInsets.only(right: AppLayout.getHeight(16)),
child: Column(children: [
//Showing the blue part
Container(
decoration: BoxDecoration(
color: isColor == null ? Color(0xff526799) : Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(AppLayout.getHeight(21)),
topRight: Radius.circular(AppLayout.getHeight(21)),
),
),
padding: EdgeInsets.all(AppLayout.getHeight(16)),
child: Column(
children: [
Row(
children: [
Text(ticket['from']['code'],
style: isColor == null
? Styles.headLineStyle3.copyWith(
color: Colors.white,
)
: Styles.headLineStyle3),
Expanded(child: Container()),
ThickContainer(isColor: true),
Expanded(
child: Stack(children: [
Center(
child: Transform.rotate(
angle: 1.5,
child: Icon(Icons.local_airport,
color: isColor == null
? Colors.white
: Color(0xFF8ACCF7)),
),
),
SizedBox(
height: AppLayout.getHeight(24),
child: AppLayoutBuilderWidget(sections: 6)),
])),
ThickContainer(isColor: true),
const Spacer(),
Text(
ticket['to']['code'],
style: isColor == null
? Styles.headLineStyle3.copyWith(
color: Colors.white,
)
: Styles.headLineStyle3,
),
],
),
const Gap(2),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
width: AppLayout.getWidth(100),
child: Text(ticket['from']['name'],
style: isColor == null
? Styles.headLineStyle4
.copyWith(color: Colors.white)
: Styles.headLineStyle4)),
Text(ticket['flying_time'],
style: isColor == null
? Styles.headLineStyle4
.copyWith(color: Colors.white)
: Styles.headLineStyle4),
SizedBox(
width: AppLayout.getWidth(100),
child: Text(ticket['to']['name'],
textAlign: TextAlign.end,
style: isColor == null
? Styles.headLineStyle4
.copyWith(color: Colors.white)
: Styles.headLineStyle4)),
],
)
],
),
),
//showing the orange part
Container(
color: isColor == null ? Styles.orangeColor : Colors.white,
child: Row(
children: [
SizedBox(
width: 10,
height: 20,
child: DecoratedBox(
decoration: BoxDecoration(
color: isColor == null
? Colors.grey.shade200
: Colors.white,
borderRadius: BorderRadius.only(
topRight: Radius.circular(10),
bottomRight: Radius.circular(10),
)),
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(6.0),
child: LayoutBuilder(builder:
(BuildContext context, BoxConstraints constraints) {
return Flex(
direction: Axis.horizontal,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.max,
children: List.generate(
(constraints.constrainWidth() / 15).floor(),
(index) => SizedBox(
width: 5,
height: 1,
child: DecoratedBox(
decoration: BoxDecoration(
color: isColor == null
? Colors.white
: Colors.grey.shade300,
),
),
)),
);
}),
),
),
SizedBox(
width: AppLayout.getWidth(10),
height: AppLayout.getHeight(20),
child: DecoratedBox(
decoration: BoxDecoration(
color: isColor == null
? Colors.grey.shade200
: Colors.white,
borderRadius: BorderRadius.only(
//border radius for the orange part at right small circle
topLeft: Radius.circular(10),
bottomLeft: Radius.circular(10),
)),
),
),
],
),
),
// Container for bottom part of orange part
Container(
decoration: BoxDecoration(
color: isColor == null ? Styles.orangeColor : Colors.white,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(isColor == null ? 21 : 0),
bottomRight: Radius.circular(isColor == null ? 21 : 0),
),
),
padding:
const EdgeInsets.only(left: 16, top: 10, right: 16, bottom: 16),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment
.spaceBetween, //its make this two column in some spacebetween
children: [
AppColumnLayout(
firstText: ticket['date'],
secondText: "Date",
alignment: CrossAxisAlignment.start,
isColor: isColor),
AppColumnLayout(
firstText: ticket['departure_time'],
secondText: "Departure time",
alignment: CrossAxisAlignment.center,
isColor: isColor),
AppColumnLayout(
firstText: ticket['number'].toString(),
secondText: "Number",
alignment: CrossAxisAlignment.end,
isColor: isColor),
],
)
],
),
),
]),
),
);
}
}
| 0 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.