repo_id
stringlengths 21
168
| file_path
stringlengths 36
210
| content
stringlengths 1
9.98M
| __index_level_0__
int64 0
0
|
---|---|---|---|
mirrored_repositories/My_ID_App | mirrored_repositories/My_ID_App/lib/main.dart | import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(
home: MyCard(),
));
}
class MyCard extends StatefulWidget {
const MyCard({super.key});
@override
State<MyCard> createState() => _MyCardState();
}
class _MyCardState extends State<MyCard> {
int gradeLevel = 0;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey[900],
appBar: AppBar(
title: Text('MY ID CARD',style: TextStyle(color: Colors.white),),
centerTitle: true,
backgroundColor: Colors.grey[850],
elevation: 0,
),
body: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.fromLTRB(30,40,30,0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Center(
child: CircleAvatar(
backgroundImage: AssetImage('assets/profile.jpg'),
radius: 60,
),
),
Divider(
height: 30,
color: Colors.amber[200],
),
Text(
'NAME',
style: TextStyle(color: Colors.grey,letterSpacing: 2)
),
Text(
'Abdullah Ellahi',
style: TextStyle(color: Colors.amber[200],
letterSpacing: 2,
fontSize: 22,
fontWeight: FontWeight.bold,
)
),
SizedBox(height: 10,),
Text(
'Father Name',
style: TextStyle(color: Colors.grey,letterSpacing: 2)
),
Text(
'Jawed Ellahi',
style: TextStyle(color: Colors.amber[200],
letterSpacing: 2,
fontSize: 22,
fontWeight: FontWeight.bold,
)
),
SizedBox(height: 10,),
Text(
'Status',
style: TextStyle(color: Colors.grey,letterSpacing: 2)
),
Text(
'Student',
style: TextStyle(color: Colors.amber[200],
letterSpacing: 2,
fontSize: 22,
fontWeight: FontWeight.bold,
)
),
SizedBox(height: 10,),
Text(
'Department',
style: TextStyle(color: Colors.grey,letterSpacing: 2)
),
Text(
'Software Engineering',
style: TextStyle(color: Colors.amber[200],
letterSpacing: 2,
fontSize: 22,
fontWeight: FontWeight.bold,
)
),
SizedBox(height: 10,),
Text(
'DATE OF BIRTH',
style: TextStyle(color: Colors.grey,letterSpacing: 2)
),
Text(
'October 7, 2003',
style: TextStyle(color: Colors.amber[200],
letterSpacing: 2,
fontSize: 22,
fontWeight: FontWeight.bold,
)
),
// Text(
// 'CURRENT GRADE LEVEL',
// style: TextStyle(color: Colors.grey,letterSpacing: 2)
// ),
// SizedBox(height: 10,),
// Text(
// '$gradeLevel',
// style: TextStyle(color: Colors.amber[200],
// letterSpacing: 2,
// fontSize: 22,
// fontWeight: FontWeight.bold,
// )
// ),
// SizedBox(height: 30,),
Divider(
height: 30,
color: Colors.amber[200],
),
Row(
children: [
Icon(
IconData(0xe11b, fontFamily: 'MaterialIcons'),
color: Colors.grey,
),
SizedBox(width: 7,),
Text(
'FAST NUCES',
style: TextStyle(
color: Colors.grey[400],
fontSize: 18,
letterSpacing: 1,
),
),
],
),
SizedBox(height: 30,),
Row(
children: [
Icon(
IconData(0xe559, fontFamily: 'MaterialIcons'),
color: Colors.grey,
),
SizedBox(width: 7,),
Text(
'June 2026',
style: TextStyle(
color: Colors.grey[400],
fontSize: 18,
letterSpacing: 1,
),
),
],
),
SizedBox(height: 30,),
Row(
children: [
Icon(
Icons.email,
color: Colors.grey,
),
SizedBox(width: 7,),
Text(
'[email protected]',
style: TextStyle(
color: Colors.grey[400],
fontSize: 18,
letterSpacing: 1,
),
)
],
),
],
),
),
),
// floatingActionButton: FloatingActionButton(
// onPressed: (){
// setState(() {
// gradeLevel += 1;
// });
// },
// child: Icon(Icons.add),
// backgroundColor: Colors.grey[800],
// hoverElevation: 100,
// foregroundColor: Colors.amber[200],
// focusColor: Colors.orange[200],
// ),
);
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite | mirrored_repositories/FlutterFoodyBite/lib/main.dart | import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:foodybite/constants/colors.dart';
import 'package:foodybite/controllers/settings_controller.dart';
import 'package:foodybite/translations/translation.dart';
import 'package:foodybite/utils/size_config.dart';
import 'package:foodybite/view/pages/AuthFlow/Splash/splash_page.dart';
import 'package:get/get.dart';
import 'package:get_storage/get_storage.dart';
void main() async {
await GetStorage.init();
runApp(MyApp());
}
class MyApp extends StatelessWidget {
final _con = Get.put(SettingsController());
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
]);
return GetMaterialApp(
debugShowCheckedModeBanner: false,
translations: Translation(),
locale: _con.currentLocale ?? Get.deviceLocale,
fallbackLocale: const Locale('en', 'US'),
theme: ThemeData(
fontFamily: 'JosefinSans',
scaffoldBackgroundColor: backgroundColor,
),
home: Root(),
);
}
}
class Root extends StatelessWidget {
@override
Widget build(BuildContext context) {
SizeConfig.initSize(context);
return SplashPage();
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib | mirrored_repositories/FlutterFoodyBite/lib/constants/images.dart | import 'package:foodybite/models/restaurant_model.dart';
class Images {
static const splash = 'assets/images/splash.jpg';
static const login = 'assets/images/login.jpg';
static const register = 'assets/images/register.jpg';
static const welcome = 'assets/images/welcome.jpg';
static const food = 'assets/images/food.jpg';
static const american = 'assets/images/american.jpg';
static const arabian = 'assets/images/arabian.jpg';
static const chinese = 'assets/images/chinese.jpg';
static const indian = 'assets/images/indian.jpg';
static const italian = 'assets/images/italian.jpg';
static const korean = 'assets/images/korean.jpg';
static const maxican = 'assets/images/maxican.jpg';
static const thai = 'assets/images/thai.jpg';
static const f1 = 'assets/images/f (1).jpg';
static const f2 = 'assets/images/f (2).jpg';
static const f3 = 'assets/images/f (3).jpg';
static const f4 = 'assets/images/f (4).jpg';
static const f5 = 'assets/images/f (5).jpg';
static const f6 = 'assets/images/f (6).jpg';
static const f7 = 'assets/images/f (7).jpg';
static const f8 = 'assets/images/f (8).jpg';
static const f9 = 'assets/images/f (9).jpg';
static const f10 = 'assets/images/f (10).jpg';
static const f11 = 'assets/images/f (11).jpg';
static const f12 = 'assets/images/f (12).jpg';
static const f13 = 'assets/images/f (13).jpg';
static const f14 = 'assets/images/f (14).jpg';
static const d1 = 'assets/images/dp (1).jpg';
static const d2 = 'assets/images/dp (2).jpg';
static const d3 = 'assets/images/dp (3).jpg';
static const d4 = 'assets/images/dp (4).jpg';
static const d6 = 'assets/images/dp (6).jpg';
static const d5 = 'assets/images/dp (5).jpg';
static const d7 = 'assets/images/dp (7).jpg';
static const d8 = 'assets/images/dp (8).jpg';
static const d9 = 'assets/images/dp (9).jpg';
static const d10 = 'assets/images/dp (10).jpg';
static const d11 = 'assets/images/dp (11).jpg';
static String getCategoryImage(FCategory category) {
switch (category) {
case FCategory.american:
return american;
case FCategory.arabian:
return arabian;
case FCategory.chinese:
return chinese;
case FCategory.indian:
return indian;
case FCategory.italian:
return italian;
case FCategory.korean:
return korean;
case FCategory.mexican:
return maxican;
case FCategory.thai:
return thai;
default:
return italian;
}
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib | mirrored_repositories/FlutterFoodyBite/lib/constants/icons.dart | class MIcons {
static const mail = 'assets/icons/email.svg';
static const lock = 'assets/icons/lock.svg';
static const bell_f = 'assets/icons/bell_f.svg';
static const bell_o = 'assets/icons/bell_o.svg';
static const bookmark_f = 'assets/icons/bookmark_f.svg';
static const bookmark_o = 'assets/icons/bookmark_o.svg';
static const filter = 'assets/icons/filter.svg';
static const home_f = 'assets/icons/home_f.svg';
static const home_o = 'assets/icons/home_o.svg';
static const search = 'assets/icons/search.svg';
static const user_f = 'assets/icons/user_f.svg';
static const user_o = 'assets/icons/user_o.svg';
static const no_food = 'assets/icons/nofood.svg';
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib | mirrored_repositories/FlutterFoodyBite/lib/constants/colors.dart | import 'package:flutter/material.dart';
import 'package:foodybite/models/restaurant_model.dart';
// Single Colors
const primaryColor = Color(0xFF5663FF);
const secondaryColor = Color(0xFF6E7FAA);
const textColor = Color(0xFF222455);
final secondaryTextColor = const Color(0xFF6E7FAA).withOpacity(0.8);
final textFieldColor = Colors.white.withOpacity(0.25);
final backgroundColor = Colors.grey[50];
const appBarColor = Colors.white;
const ratingBarColor = Color(0xFFF6FBFF);
const ratingStarColor = Color(0xFFffcc00);
// Food Category Gradients
const italianGradient = LinearGradient(colors: [
Color(0xFFFF5673),
Color(0xFFFF8C48),
]);
const chineseGradient = LinearGradient(colors: [
Color(0xFF832BF6),
Color(0xFFFF4665),
]);
const maxicanGradient = LinearGradient(colors: [
Color(0xFF2DCEF8),
Color(0xFF3B40FE),
]);
const thaiGradient = LinearGradient(colors: [
Color(0xFF009DC5),
Color(0xFF21E590),
]);
const arabianGradient = LinearGradient(colors: [
Color(0xFFFF870E),
Color(0xFFD236D2),
]);
const indianGradient = LinearGradient(colors: [
Color(0xFFFE327E),
Color(0xFF5C51FF),
]);
const americanGradient = LinearGradient(colors: [
Color(0xFF2CE3F1),
Color(0xFF6143FF),
]);
const korianGradient = LinearGradient(colors: [
Color(0xFFFF5673),
Color(0xFFFF8C48),
]);
LinearGradient getCategoryGradient(FCategory category) {
switch (category) {
case FCategory.american:
return americanGradient;
case FCategory.arabian:
return arabianGradient;
case FCategory.chinese:
return chineseGradient;
case FCategory.indian:
return indianGradient;
case FCategory.italian:
return italianGradient;
case FCategory.korean:
return korianGradient;
case FCategory.mexican:
return maxicanGradient;
case FCategory.thai:
return thaiGradient;
default:
return italianGradient;
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib | mirrored_repositories/FlutterFoodyBite/lib/constants/consts.dart | import 'package:foodybite/utils/size_config.dart';
const double defaultPadding = 16;
const double defaultBorderRadius = 8;
final double bottomPadding = getRelativeHeight(0.075);
| 0 |
mirrored_repositories/FlutterFoodyBite/lib | mirrored_repositories/FlutterFoodyBite/lib/constants/values.dart | class Values {
static const arabian = 'arabian';
static const american = 'american';
static const indian = 'indian';
static const thai = 'thai';
static const chinese = 'chinese';
static const mexican = 'mexican';
static const italian = 'italian';
static const korean = 'korean';
static const arabic = 'arabic';
static const english = 'english';
static const spanish = 'spanish';
static const are_you_sure_change_language = "are_you_sure_change_language";
static const email = 'email';
static const password = 'password';
static const forgot_password = 'forgot_password';
static const login = 'login';
static const create_new_account = 'create_new_account';
static const send = 'send';
static const enter_email_for_forgot_password =
'enter_email_for_forgot_password';
static const name = 'name';
static const confirm_password = 'confirm_password';
static const register = 'register';
static const already_have_account = 'already_have_account';
static const hi = 'hi';
static const welcome_to = 'welcome_to';
static const please_turn_on_gps = 'please_turn_on_gps';
static const turn_on_gps = 'turn_on_gps';
static const find_restaurants = 'find_restaurants';
static const trending_restaurants = 'trending_restaurants';
static const see_all = 'see_all';
static const open = 'open';
static const close = 'close';
static const category = 'category';
static const friends = 'friends';
static const filter = 'filter';
static const select_category = 'select_category';
static const distance = 'distance';
static const ratings = 'ratings';
static const reset = 'reset';
static const apply = 'apply';
static const search = 'search';
static const open_now = 'open_now';
static const close_now = 'close_now';
static const daily_time = 'daily_time';
static const menu_n_photos = 'menu_n_photos';
static const review_n_ratings = 'review_n_ratings';
static const rate_your_experience = 'rate_your_experience';
static const direction = 'direction';
static const preview = 'preview';
static const write_your_experience = 'write_your_experience';
static const done = 'done';
static const find_friends = 'find_friends';
static const suggestions = 'suggestions';
static const follow = 'follow';
static const followers = 'followers';
static const following = 'following';
static const unfollow = 'unfollow';
static const profile = 'profile';
static const my_profile = 'my_profile';
static const reviews = 'reviews';
static const block = 'block';
static const post = 'post';
static const new_review = 'new_review';
static const edit_review = 'edit_review';
static const search_restaurants = 'search_restaurants';
static const my_favourite = 'my_favourite';
static const notifications = 'notifications';
static const settings = 'settings';
static const account = 'account';
static const change_password = 'change_password';
static const change_language = 'change_language';
static const others = 'others';
static const privacy_policy = 'privacy_policy';
static const terms_n_conditions = 'terms_n_conditions';
static const logout = 'logout';
static const current_password = 'current_password';
static const new_password = 'new_password';
static const select_language = 'select_language';
static const update = 'update';
static const yes = 'yes';
static const no = 'no';
static const are_you_sure_logout = 'are_you_sure_logout';
static const edit_profile = 'edit_profile';
static const edit = 'edit';
static const cancel = 'cancel';
static const delete = 'delete';
static const are_you_sure_delete_post = 'are_you_sure_delete_post';
static const chose_or_take_picture = 'chose_or_take_picture';
static const camera = 'camera';
static const gallery = 'gallery';
static const skip = 'skip';
static const categories = "categories";
static const review = "review";
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib | mirrored_repositories/FlutterFoodyBite/lib/controllers/settings_controller.dart | import 'package:flutter/material.dart';
import 'package:foodybite/services/local_db_service.dart';
import 'package:foodybite/view/pages/ProfilenSettingFlow/ChangeLanguage/change_language_page.dart';
import 'package:get/get.dart';
class SettingsController extends GetxController {
Language currentLanguage;
Locale currentLocale;
final _localDBService = LocalDBService();
@override
void onInit() {
final langFromDB = _localDBService.getLanguage();
print(langFromDB);
if (langFromDB != null) {
currentLanguage = _getLanguageByLocale(langFromDB);
currentLocale = _getLocaleByLanguage(currentLanguage);
} else {
currentLocale = Get.deviceLocale;
currentLanguage = _getLanguageByLocale(currentLocale.languageCode);
}
super.onInit();
}
void updateLanguage(Language language) {
final _locale = _getLocaleByLanguage(language);
Get.updateLocale(_locale);
_localDBService.saveLanguage(_locale.languageCode);
currentLanguage = language;
update();
}
Language _getLanguageByLocale(String l_code) {
switch (l_code) {
case 'en':
return Language.english;
case 'zh':
return Language.chinese;
case 'ar':
return Language.arabic;
case 'es':
return Language.spanish;
default:
return Language.english;
}
}
Locale _getLocaleByLanguage(Language language) {
switch (language) {
case Language.english:
return const Locale('en', 'US');
case Language.chinese:
return const Locale('zh', 'CN');
case Language.arabic:
return const Locale('ar', 'SA');
case Language.spanish:
return const Locale('es', 'ES');
default:
return const Locale('en', 'US');
}
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib | mirrored_repositories/FlutterFoodyBite/lib/controllers/profile_controller.dart | import 'dart:io';
import 'package:foodybite/services/system_service.dart';
import 'package:get/get.dart';
class ProfileController extends GetxController {
final _systemService = SystemService();
File imageFile;
void getImageFromGallery() async {
final xfile = await _systemService.imageFromGallery();
imageFile = File(xfile.path);
update();
}
void getImageFromCamer() async {
final xfile = await _systemService.imageFromCamera();
try {
imageFile = File(xfile.path);
} catch (e) {
print('image not clicked');
}
update();
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view/pages/ProfilenSettingFlow | mirrored_repositories/FlutterFoodyBite/lib/view/pages/ProfilenSettingFlow/EditProfile/edit_profile_page.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/colors.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/constants/icons.dart';
import 'package:foodybite/constants/images.dart';
import 'package:foodybite/constants/values.dart';
import 'package:foodybite/controllers/profile_controller.dart';
import 'package:foodybite/utils/size_config.dart';
import 'package:foodybite/utils/validators.dart';
import 'package:foodybite/view/dialogs/m_dialogs.dart';
import 'package:foodybite/view/widgets/app_bar.dart';
import 'package:foodybite/view/widgets/input_field.dart';
import 'package:foodybite/view/widgets/mbutton.dart';
import 'package:get/get.dart';
class EditPofilePage extends StatefulWidget {
@override
_EditPofilePageState createState() => _EditPofilePageState();
}
class _EditPofilePageState extends State<EditPofilePage> {
final _nameController = TextEditingController();
final _emailController = TextEditingController();
final _profileController = Get.find<ProfileController>();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MAppBar(
title: Values.edit_profile.tr,
appBar: AppBar(),
),
body: SizedBox.expand(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: defaultPadding),
child: Column(
children: [
const SizedBox(height: defaultPadding * 2),
SizedBox(
height: getRelativeWidth(0.3),
width: getRelativeWidth(0.3),
child: Stack(
children: [
GetBuilder<ProfileController>(builder: (_con) {
return CircleAvatar(
radius: getRelativeWidth(0.15),
backgroundImage: _con.imageFile != null
? FileImage(_con.imageFile)
: const AssetImage(
Images.d1,
),
);
}),
Positioned(
right: 0,
bottom: 0,
child: GestureDetector(
onTap: () {
MDialogs.imagePickerDialog(
onCameraTap: () {
Get.back();
_profileController.getImageFromCamer();
},
onGalleryTap: () {
Get.back();
_profileController.getImageFromGallery();
},
);
},
child: Container(
height: 38,
width: 38,
decoration: BoxDecoration(
color: primaryColor,
shape: BoxShape.circle,
border: Border.all(
width: 2,
color: Colors.white,
)),
child: const Icon(
Icons.edit,
size: 20,
color: Colors.white,
)),
),
),
],
),
),
const SizedBox(height: defaultPadding * 3),
InputField(
hint: 'John Williams',
controller: _nameController,
isWhite: false,
iconPath: MIcons.user_o,
),
const SizedBox(height: defaultPadding),
InputField(
hint: '[email protected]',
controller: _emailController,
isWhite: false,
validator: (val) => Validators.emailValidator(val),
iconPath: MIcons.mail,
),
const Spacer(),
MButton(
label: Values.update.tr,
onTap: () {},
),
const SizedBox(height: defaultPadding * 2),
],
),
),
),
);
}
@override
void dispose() {
_nameController.dispose();
_emailController.dispose();
super.dispose();
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view/pages/ProfilenSettingFlow | mirrored_repositories/FlutterFoodyBite/lib/view/pages/ProfilenSettingFlow/ChangePassword/change_password_page.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/constants/icons.dart';
import 'package:foodybite/constants/values.dart';
import 'package:foodybite/utils/validators.dart';
import 'package:foodybite/view/widgets/app_bar.dart';
import 'package:foodybite/view/widgets/input_field.dart';
import 'package:foodybite/view/widgets/mbutton.dart';
import 'package:get/get.dart';
class ChangePasswordPage extends StatefulWidget {
@override
_ChangePasswordPageState createState() => _ChangePasswordPageState();
}
class _ChangePasswordPageState extends State<ChangePasswordPage> {
final _currentPassController = TextEditingController();
final _passwordController = TextEditingController();
final _confirmPasswordController = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MAppBar(
appBar: AppBar(),
title: Values.change_password.tr,
),
body: SizedBox.expand(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: defaultPadding),
child: Column(
children: [
const SizedBox(height: defaultPadding * 2),
InputField(
validator: (value) => Validators.passwordValidator(value),
hint: Values.current_password.tr,
controller: _currentPassController,
isPassword: true,
iconPath: MIcons.lock,
isWhite: false,
),
const SizedBox(height: defaultPadding),
InputField(
validator: (value) => Validators.passwordValidator(value),
hint: Values.new_password.tr,
controller: _passwordController,
isPassword: true,
iconPath: MIcons.lock,
isWhite: false,
),
const SizedBox(height: defaultPadding),
InputField(
validator: (value) => Validators.confirmPasswordValidator(
_passwordController.text, value),
hint: Values.confirm_password.tr,
controller: _passwordController,
isPassword: true,
iconPath: MIcons.lock,
isWhite: false,
),
const Spacer(),
MButton(
label: Values.update.tr,
onTap: () {},
),
const SizedBox(height: defaultPadding),
],
)),
),
);
}
@override
void dispose() {
_currentPassController.dispose();
_passwordController.dispose();
_confirmPasswordController.dispose();
super.dispose();
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view/pages/ProfilenSettingFlow | mirrored_repositories/FlutterFoodyBite/lib/view/pages/ProfilenSettingFlow/Profile/profile_page.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/colors.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/constants/values.dart';
import 'package:foodybite/controllers/profile_controller.dart';
import 'package:foodybite/models/data.dart';
import 'package:foodybite/models/user_model.dart';
import 'package:foodybite/utils/size_config.dart';
import 'package:foodybite/view/dialogs/m_dialogs.dart';
import 'package:foodybite/view/pages/HomeFlow/Reviews/review_rating_page.dart';
import 'package:foodybite/view/pages/NewReview/new_review_page.dart';
import 'package:foodybite/view/pages/ProfilenSettingFlow/EditProfile/edit_profile_page.dart';
import 'package:foodybite/view/pages/ProfilenSettingFlow/UserListing/user_listing_page.dart';
import 'package:foodybite/view/pages/ProfilenSettingFlow/settings/settings_page.dart';
import 'package:foodybite/view/widgets/app_bar.dart';
import 'package:foodybite/view/widgets/mbutton.dart';
import 'package:foodybite/view/widgets/restaurant_tile.dart';
import 'package:get/get.dart';
class ProfilePage extends StatelessWidget {
ProfilePage({
@required this.isMe,
@required this.user,
});
final bool isMe;
final UserModel user;
final _profileController = Get.put(ProfileController());
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MAppBar(
title: isMe ? Values.my_profile.tr : Values.profile.tr,
appBar: AppBar(),
),
body: SizedBox.expand(
child: SingleChildScrollView(
child: Column(
children: [
const SizedBox(height: defaultPadding * 2),
GetBuilder<ProfileController>(builder: (_con) {
return CircleAvatar(
radius: getRelativeWidth(0.15),
backgroundImage: _con.imageFile != null
? FileImage(_con.imageFile)
: AssetImage(
user.imgPath,
),
);
}),
const SizedBox(height: defaultPadding),
Text(
user.name,
style: Theme.of(context).textTheme.headline5.copyWith(
color: textColor,
fontWeight: FontWeight.w600,
),
),
const SizedBox(height: defaultPadding / 4),
Text(
'[email protected]',
style: Theme.of(context)
.textTheme
.bodyText2
.copyWith(color: secondaryTextColor),
),
const SizedBox(height: defaultPadding * 1.5),
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
CountTile(
label: Values.reviews.tr,
count: 120,
onTap: () {
Get.to(() => const ReviewRatingPage(showMyRatings: true));
},
),
Container(
margin: EdgeInsets.symmetric(
horizontal: getRelativeWidth(0.07),
),
height: 30,
width: 0.5,
color: secondaryTextColor,
),
CountTile(
label: Values.followers.tr,
count: 240,
onTap: () {
Get.to(() => UserListingPage(
appBarTitle: Values.followers.tr,
userList: userList,
));
}),
Container(
margin: EdgeInsets.symmetric(
horizontal: getRelativeWidth(0.07),
),
height: 30,
width: 0.5,
color: secondaryTextColor,
),
CountTile(
label: Values.following.tr,
count: 74,
onTap: () {
Get.to(() => UserListingPage(
appBarTitle: Values.following.tr,
userList: userList,
isFollowing: true,
));
})
]),
const SizedBox(height: defaultPadding * 1.5),
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
MButton(
label: isMe ? Values.edit_profile.tr : Values.follow.tr,
onTap: isMe
? () {
Get.to(
() => EditPofilePage(),
);
}
: () {},
width: getRelativeWidth(0.35),
height: 45,
),
const SizedBox(width: defaultPadding),
MButton(
isFilled: false,
label: isMe ? Values.settings.tr : Values.block.tr,
onTap: isMe
? () {
Get.to(() => SettingsPage());
}
: () {},
width: getRelativeWidth(0.35),
height: 45,
),
]),
const SizedBox(height: defaultPadding),
const Divider(
height: defaultPadding,
color: secondaryColor,
),
ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: 3,
itemBuilder: (_, index) => RestaurantTile(
forProfile: true,
restaurant: restaurantList[index],
menuTap: () {
MDialogs.menuDialog(
onDeleteTap: () {
Get.back();
MDialogs.confirmationDialog(
title: Values.are_you_sure_delete_post.tr,
onYesTap: () {},
onNoTap: () {
Get.back();
},
);
},
onEditTap: () {
Get.back();
Get.to(() => const NewReviewPage(
isUpdate: true,
));
},
);
},
),
),
const SizedBox(height: defaultPadding * 8),
],
),
),
),
);
}
}
class CountTile extends StatelessWidget {
const CountTile({
@required this.count,
@required this.label,
@required this.onTap,
});
final String label;
final int count;
final VoidCallback onTap;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onTap,
child: Column(children: [
Text(
count.toString(),
style: Theme.of(context).textTheme.headline6.copyWith(
color: primaryColor,
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: defaultPadding / 3),
Text(label,
style: Theme.of(context).textTheme.bodyText1.copyWith(
color: secondaryTextColor,
fontWeight: FontWeight.w500,
)),
]),
);
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view/pages/ProfilenSettingFlow | mirrored_repositories/FlutterFoodyBite/lib/view/pages/ProfilenSettingFlow/settings/settings_page.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/colors.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/constants/values.dart';
import 'package:foodybite/controllers/settings_controller.dart';
import 'package:foodybite/view/dialogs/m_dialogs.dart';
import 'package:foodybite/view/pages/AuthFlow/Login/login_page.dart';
import 'package:foodybite/view/pages/ProfilenSettingFlow/ChangeLanguage/change_language_page.dart';
import 'package:foodybite/view/pages/ProfilenSettingFlow/ChangePassword/change_password_page.dart';
import 'package:foodybite/view/widgets/app_bar.dart';
import 'package:get/get.dart';
class SettingsPage extends StatelessWidget {
final _con = Get.put(SettingsController());
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MAppBar(
appBar: AppBar(),
title: Values.settings.tr,
),
body: SizedBox.expand(
child: Column(
children: [
Padding(
padding: const EdgeInsets.only(
left: defaultPadding,
right: defaultPadding,
bottom: defaultPadding / 2,
top: defaultPadding,
),
child: Align(
alignment: Get.locale.languageCode == 'ar'
? Alignment.centerRight
: Alignment.centerLeft,
child: Text(
Values.account.tr,
style: Theme.of(context).textTheme.subtitle1.copyWith(
color: secondaryTextColor,
),
),
),
),
const SizedBox(height: defaultPadding / 2),
SettingButton(
label: Values.change_password.tr,
onTap: () {
Get.to(() => ChangePasswordPage());
},
),
SettingButton(
label: Values.change_language.tr,
onTap: () {
Get.to(() => ChangeLanguagePage());
},
),
Padding(
padding: const EdgeInsets.only(
left: defaultPadding,
right: defaultPadding,
bottom: defaultPadding / 2,
top: defaultPadding,
),
child: Align(
alignment: Get.locale.languageCode == 'ar'
? Alignment.centerRight
: Alignment.centerLeft,
child: Text(
Values.others.tr,
style: Theme.of(context).textTheme.subtitle1.copyWith(
color: secondaryTextColor,
),
),
),
),
const SizedBox(height: defaultPadding / 2),
SettingButton(
label: Values.privacy_policy.tr,
onTap: () {},
),
SettingButton(
label: Values.terms_n_conditions.tr,
onTap: () {},
),
GestureDetector(
onTap: () {
MDialogs.confirmationDialog(
title: Values.are_you_sure_logout.tr,
onNoTap: () {
Get.back();
},
onYesTap: () {
Get.offAll(() => LoginPage());
},
);
},
child: Container(
// height: 50,
color: Colors.white,
padding: const EdgeInsets.symmetric(
vertical: defaultPadding,
horizontal: defaultPadding,
),
child: Align(
alignment: Get.locale.languageCode == 'ar'
? Alignment.centerRight
: Alignment.centerLeft,
child: Text(
Values.logout.tr,
style: Theme.of(context).textTheme.subtitle1.copyWith(
color: primaryColor,
fontWeight: FontWeight.w800,
),
),
),
),
),
],
),
));
}
}
class SettingButton extends StatelessWidget {
const SettingButton({
@required this.label,
@required this.onTap,
});
final String label;
final VoidCallback onTap;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onTap,
child: Container(
margin: const EdgeInsets.only(
bottom: 3,
),
color: Colors.white,
padding: const EdgeInsets.symmetric(
horizontal: defaultPadding, vertical: defaultPadding * 0.8),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
label,
style: Theme.of(context).textTheme.subtitle1.copyWith(
fontWeight: FontWeight.w600,
),
),
Icon(
Get.locale.languageCode == 'ar'
? Icons.keyboard_arrow_left
: Icons.keyboard_arrow_right,
size: 28,
color: secondaryTextColor,
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view/pages/ProfilenSettingFlow | mirrored_repositories/FlutterFoodyBite/lib/view/pages/ProfilenSettingFlow/UserListing/user_listing_page.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/colors.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/constants/values.dart';
import 'package:foodybite/models/data.dart';
import 'package:foodybite/models/user_model.dart';
import 'package:foodybite/view/pages/ProfilenSettingFlow/Profile/profile_page.dart';
import 'package:foodybite/view/widgets/app_bar.dart';
import 'package:foodybite/view/widgets/mbutton.dart';
import 'package:get/get.dart';
class UserListingPage extends StatelessWidget {
const UserListingPage(
{this.findNewFriends = false,
@required this.appBarTitle,
this.isFollowing = false,
@required this.userList});
final List<UserModel> userList;
final String appBarTitle;
final bool findNewFriends, isFollowing;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MAppBar(
title: appBarTitle,
appBar: AppBar(),
),
body: SizedBox.expand(
child: Column(
children: [
if (findNewFriends)
Padding(
padding: const EdgeInsets.only(
left: defaultPadding,
bottom: defaultPadding * 1.5,
),
child: Align(
alignment: Alignment.centerLeft,
child: Text(
Values.suggestions.tr,
style: Theme.of(context).textTheme.subtitle1.copyWith(
color: secondaryTextColor,
),
),
),
),
Expanded(
child: ListView.builder(
itemCount: userList.length,
itemBuilder: (_, index) =>
UserTile(isFollowing: isFollowing, user: userList[index]),
),
),
],
),
));
}
}
class UserTile extends StatelessWidget {
const UserTile({@required this.isFollowing, @required this.user});
final UserModel user;
final bool isFollowing;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
Get.to(
() => ProfilePage(
user: userList[0],
isMe: false),
);
},
child: Container(
margin: const EdgeInsets.symmetric(
horizontal: defaultPadding,
),
padding: const EdgeInsets.only(
bottom: defaultPadding,
top: defaultPadding / 2,
),
child: Row(
children: [
CircleAvatar(
radius: 24,
backgroundImage: AssetImage(
user.imgPath,
),
),
const SizedBox(
width: defaultPadding,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
user.name,
style: Theme.of(context).textTheme.subtitle1.copyWith(
color: textColor,
fontWeight: FontWeight.w600,
),
),
const SizedBox(height: defaultPadding / 2),
Text(
user.reviews.length.toString() + ' ' + Values.reviews.tr,
style: Theme.of(context)
.textTheme
.caption
.copyWith(fontWeight: FontWeight.w800),
),
],
),
const Spacer(),
MButton(
isFilled: !isFollowing,
txtSize: 12,
label: isFollowing ? Values.unfollow.tr : Values.follow.tr,
onTap: () {},
height: 26,
width: 70,
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view/pages/ProfilenSettingFlow | mirrored_repositories/FlutterFoodyBite/lib/view/pages/ProfilenSettingFlow/ChangeLanguage/change_language_page.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/colors.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/constants/values.dart';
import 'package:foodybite/controllers/settings_controller.dart';
import 'package:foodybite/view/dialogs/m_dialogs.dart';
import 'package:foodybite/view/widgets/app_bar.dart';
import 'package:get/get.dart';
enum Language {
english,
chinese,
spanish,
arabic,
}
class ChangeLanguagePage extends StatefulWidget {
@override
_ChangeLanguagePageState createState() => _ChangeLanguagePageState();
}
class _ChangeLanguagePageState extends State<ChangeLanguagePage> {
final _settingsController = Get.find<SettingsController>();
Language _currentLanguage;
@override
void initState() {
_currentLanguage = _settingsController.currentLanguage;
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MAppBar(
appBar: AppBar(),
title: Values.change_language.tr,
actions: [
Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: defaultPadding),
child: GestureDetector(
onTap: () {
MDialogs.confirmationDialog(
title: Values.are_you_sure_change_language.tr,
onNoTap: () {
Get.back();
setState(() {
_currentLanguage =
_settingsController.currentLanguage;
});
},
onYesTap: () {
Get.back();
_settingsController.updateLanguage(_currentLanguage);
},
);
},
child: Text(Values.update.tr,
style: Theme.of(context).textTheme.subtitle1.copyWith(
color: primaryColor,
)),
),
),
),
],
),
body: SizedBox.expand(
child: Column(
children: [
Padding(
padding: const EdgeInsets.only(
right: defaultPadding,
left: defaultPadding,
bottom: defaultPadding / 2,
top: defaultPadding,
),
child: Align(
alignment: Get.locale.languageCode == 'ar'
? Alignment.centerRight
: Alignment.centerLeft,
child: Text(
Values.select_language.tr,
style: Theme.of(context).textTheme.subtitle1.copyWith(
color: secondaryTextColor,
),
),
),
),
...Language.values.map((l) {
return LanguageSelector(
onChanged: (v) {
setState(() {
_currentLanguage = l;
});
},
title: l.toString().split('.').last.tr,
radioValue: _currentLanguage == l ? 1 : 0,
);
}).toList(),
],
)));
}
}
class LanguageSelector extends StatelessWidget {
const LanguageSelector({
@required this.onChanged,
@required this.title,
@required this.radioValue,
});
final Function onChanged;
final String title;
final int radioValue;
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.only(
bottom: 3,
),
padding: EdgeInsets.only(
left: Get.locale.languageCode == 'ar'
? defaultPadding / 2
: defaultPadding,
right: Get.locale.languageCode == 'ar'
? defaultPadding
: defaultPadding / 2,
top: defaultPadding / 3,
bottom: defaultPadding / 3,
),
color: Colors.white,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
title,
style: Theme.of(context).textTheme.subtitle1,
),
Radio(
value: radioValue,
groupValue: 1,
onChanged: onChanged,
activeColor: primaryColor,
),
],
),
);
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view/pages | mirrored_repositories/FlutterFoodyBite/lib/view/pages/Favourite/favourite_restaurants_page.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/values.dart';
import 'package:foodybite/models/data.dart';
import 'package:foodybite/utils/size_config.dart';
import 'package:foodybite/view/widgets/app_bar.dart';
import 'package:foodybite/view/widgets/restaurant_tile.dart';
import 'package:get/get.dart';
class FavouriteRestaurantsPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MAppBar(
title: Values.my_favourite.tr,
appBar: AppBar(),
),
body: SizedBox.expand(
child: ListView.builder(
itemCount: restaurantList.length + 1,
itemBuilder: (_, index) => index < restaurantList.length
? RestaurantTile(
restaurant: restaurantList[index],
forFavourite: true,
)
: SizedBox(
height: getRelativeHeight(0.12),
),
),
));
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view/pages/HomeFlow | mirrored_repositories/FlutterFoodyBite/lib/view/pages/HomeFlow/Trending/trending_restaurants_page.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/constants/values.dart';
import 'package:foodybite/models/data.dart';
import 'package:foodybite/view/pages/HomeFlow/Filter/filter_page.dart';
import 'package:foodybite/view/widgets/app_bar.dart';
import 'package:foodybite/view/widgets/restaurant_tile.dart';
import 'package:foodybite/view/widgets/search_field.dart';
import 'package:get/get.dart';
class TrendingRestarurantsPage extends StatefulWidget {
const TrendingRestarurantsPage({Key key}) : super(key: key);
@override
_TrendingRestarurantsPageState createState() =>
_TrendingRestarurantsPageState();
}
class _TrendingRestarurantsPageState extends State<TrendingRestarurantsPage> {
final _searchController = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MAppBar(
title: Values.trending_restaurants.tr,
appBar: AppBar(),
),
body: SizedBox.expand(
child: Column(
children: [
const SizedBox(height: defaultPadding / 2),
SearchField(
controller: _searchController,
onLeadingTap: () {
Get.to(() => FilterPage());
},
hint: '',
),
Expanded(
child: ListView.builder(
itemCount: restaurantList.length + 1,
itemBuilder: (BuildContext context, int index) {
return index < restaurantList.length
? RestaurantTile(
restaurant: restaurantList[index],
)
: const SizedBox(height: defaultPadding * 2);
},
),
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view/pages/HomeFlow | mirrored_repositories/FlutterFoodyBite/lib/view/pages/HomeFlow/Filter/filter_page.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/colors.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/constants/values.dart';
import 'package:foodybite/models/restaurant_model.dart';
import 'package:foodybite/utils/size_config.dart';
import 'package:foodybite/view/widgets/app_bar.dart';
import 'package:foodybite/view/widgets/rating_bar.dart';
import 'package:foodybite/view/widgets/round_button.dart';
import 'package:get/get.dart';
class FilterPage extends StatefulWidget {
@override
_FilterPageState createState() => _FilterPageState();
}
class _FilterPageState extends State<FilterPage> {
FCategory selectedCategory = FCategory.italian;
double _sliderValue = 10;
int _rating = 4;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MAppBar(
title: Values.filter.tr,
appBar: AppBar(),
actions: [
IconButton(
onPressed: () {},
icon: const Icon(Icons.close, color: secondaryColor),
),
],
),
body: SizedBox.expand(
child: Column(
children: [
const SizedBox(
height: defaultPadding * 1.5,
),
Text(Values.select_category.tr,
style: const TextStyle(
color: Colors.black,
fontWeight: FontWeight.w600,
fontSize: 18,
)),
const SizedBox(
height: defaultPadding * 1.5,
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: defaultPadding,
),
child: Wrap(
spacing: defaultPadding,
runSpacing: defaultPadding / 2,
children: FCategory.values.map((c) {
return GestureDetector(
onTap: () {
setState(() {
selectedCategory = c;
});
},
child: Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(defaultBorderRadius / 2),
gradient: selectedCategory == c
? getCategoryGradient(c)
: null,
border: selectedCategory != c
? Border.all(
color: secondaryColor,
width: 0.2,
)
: null,
),
height: 46,
width: getRelativeWidth(0.25),
child: Center(
child: Text(
c.toString().split('.').last.tr,
style: TextStyle(
color: c == selectedCategory
? Colors.white
: secondaryColor,
),
),
),
),
);
}).toList(),
),
),
const SizedBox(
height: defaultPadding * 2,
),
Text(Values.distance.tr,
style: const TextStyle(
color: Colors.black,
fontWeight: FontWeight.w600,
fontSize: 18,
)),
const SizedBox(
height: defaultPadding,
),
SizedBox(
height: 50,
width: getRelativeWidth(1),
child: SliderTheme(
data: SliderTheme.of(context).copyWith(
tickMarkShape: SliderTickMarkShape.noTickMark,
activeTrackColor: primaryColor,
inactiveTrackColor: primaryColor.withOpacity(0.2),
thumbColor: primaryColor,
valueIndicatorColor: primaryColor,
trackHeight: 6,
// thumbShape: const SliderThumbShape(
// thumbHeight: 40,
// min: 0,
// max: 10,
// thumbRadius: 20,
// ),
),
child: Slider(
label: _sliderValue.round().toString(),
value: _sliderValue,
max: 100,
divisions: 20,
onChanged: (val) {
setState(() {
_sliderValue = val;
});
}),
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: defaultPadding),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'0',
style: TextStyle(color: secondaryTextColor),
),
Text(
'100',
style: TextStyle(color: secondaryTextColor),
),
],
),
),
const SizedBox(
height: defaultPadding * 2,
),
Text(Values.ratings.tr,
style: const TextStyle(
color: Colors.black,
fontWeight: FontWeight.w600,
fontSize: 18,
)),
const SizedBox(
height: defaultPadding * 2,
),
RatingBar(
initialRating: 4,
onRatingChange: (val) {
print(val);
},
),
const Spacer(),
Row(
children: [
Expanded(
child: RoundButton(
onTap: () {},
label: Values.reset.tr,
rightRound: Get.locale.languageCode == 'ar' ? true : false,
leftRound: Get.locale.languageCode == 'ar' ? false : true,
),
),
const VerticalDivider(
color: Colors.white,
width: 0.5,
),
Expanded(
child: RoundButton(
onTap: () {},
label: Values.apply.tr,
rightRound: Get.locale.languageCode == 'ar' ? false : true,
leftRound: Get.locale.languageCode == 'ar' ? true : false,
),
),
],
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view/pages/HomeFlow/Filter | mirrored_repositories/FlutterFoodyBite/lib/view/pages/HomeFlow/Filter/Components/slider_thumb_shape.dart | // import 'package:flutter/material.dart';
// class SliderThumbShape extends SliderComponentShape {
// final double thumbRadius;
// final thumbHeight;
// final int min;
// final int max;
// const SliderThumbShape({
// this.thumbRadius,
// this.thumbHeight,
// this.min,
// this.max,
// });
// @override
// Size getPreferredSize(bool isEnabled, bool isDiscrete) {
// return Size.fromRadius(thumbRadius);
// }
// @override
// void paint(
// PaintingContext context,
// Offset center, {
// Animation<double> activationAnimation,
// Animation<double> enableAnimation,
// bool isDiscrete,
// TextPainter labelPainter,
// RenderBox parentBox,
// SliderThemeData sliderTheme,
// TextDirection textDirection,
// double value,
// double textScaleFactor,
// Size sizeWithOverflow,
// }) {
// final Canvas canvas = context.canvas;
// final rRect = RRect.fromRectAndRadius(
// Rect.fromCenter(
// center: center, width: thumbHeight * 1.2,
// height: thumbHeight * .6),
// Radius.circular(thumbRadius * .4),
// );
// final paint = Paint()
// ..color = sliderTheme.activeTrackColor //Thumb Background Color
// ..style = PaintingStyle.fill;
// TextSpan span = new TextSpan(
// style: new TextStyle(
// fontSize: thumbHeight * .3,
// fontWeight: FontWeight.w700,
// color: sliderTheme.thumbColor,
// height: 1),
// text: '${getValue(value)}');
// TextPainter tp = new TextPainter(
// text: span,
// textAlign: TextAlign.left,
// textDirection: TextDirection.ltr);
// tp.layout();
// Offset textCenter =
// Offset(center.dx - (tp.width / 2), center.dy - (tp.height / 2));
// canvas.drawRRect(rRect, paint);
// tp.paint(canvas, textCenter);
// }
// String getValue(double value) {
// return (min + (max - min) * value).round().toString();
// }
// }
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view/pages/HomeFlow | mirrored_repositories/FlutterFoodyBite/lib/view/pages/HomeFlow/Reviews/add_review_page.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/colors.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/constants/values.dart';
import 'package:foodybite/view/widgets/app_bar.dart';
import 'package:foodybite/view/widgets/input_field.dart';
import 'package:foodybite/view/widgets/rating_bar.dart';
import 'package:foodybite/view/widgets/round_button.dart';
import 'package:get/get.dart';
class AddReviewPage extends StatefulWidget {
@override
_AddReviewPageState createState() => _AddReviewPageState();
}
class _AddReviewPageState extends State<AddReviewPage> {
final _experienceController = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MAppBar(
title: Values.review_n_ratings.tr,
appBar: AppBar(),
actions: [
IconButton(
onPressed: () {},
icon: const Icon(Icons.close, color: secondaryColor),
),
],
),
body: SizedBox.expand(
child: Column(
children: [
const SizedBox(height: defaultPadding * 2),
RatingBar(initialRating: 0, onRatingChange: (val) {}),
const SizedBox(height: defaultPadding * 1),
Text(Values.rate_your_experience.tr,
style: TextStyle(
color: secondaryTextColor,
fontWeight: FontWeight.w600,
fontSize: 14,
)),
const SizedBox(height: defaultPadding * 3),
Padding(
padding: const EdgeInsets.symmetric(horizontal: defaultPadding),
child: InputField(
maxLines: 8,
isWhite: false,
hint: Values.write_your_experience.tr,
controller: _experienceController,
),
),
const Spacer(),
RoundButton(
label: Values.done.tr,
onTap: () {},
),
],
)));
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view/pages/HomeFlow | mirrored_repositories/FlutterFoodyBite/lib/view/pages/HomeFlow/Reviews/review_rating_page.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/values.dart';
import 'package:foodybite/models/data.dart';
import 'package:foodybite/view/widgets/app_bar.dart';
import 'package:foodybite/view/widgets/review_tile.dart';
import 'package:get/get.dart';
class ReviewRatingPage extends StatelessWidget {
const ReviewRatingPage({
@required this.showMyRatings,
});
final bool showMyRatings;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MAppBar(
title: Values.review_n_ratings.tr,
appBar: AppBar(),
),
body: SizedBox.expand(
child: ListView.builder(
itemCount: reviewList.length,
itemBuilder: (_, index) => ReviewTile(
isRestaurant: showMyRatings,
review: reviewList[index],
),
),
),
);
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view/pages/HomeFlow | mirrored_repositories/FlutterFoodyBite/lib/view/pages/HomeFlow/Restaurant/restaurant_page.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/colors.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/constants/values.dart';
import 'package:foodybite/models/data.dart';
import 'package:foodybite/models/restaurant_model.dart';
import 'package:foodybite/utils/size_config.dart';
import 'package:foodybite/view/pages/HomeFlow/MenuPhoto/menu_photo_page.dart';
import 'package:foodybite/view/pages/HomeFlow/PhotoView/photo_view_page.dart';
import 'package:foodybite/view/pages/HomeFlow/Reviews/add_review_page.dart';
import 'package:foodybite/view/pages/HomeFlow/Reviews/review_rating_page.dart';
import 'package:foodybite/view/widgets/app_bar.dart';
import 'package:foodybite/view/widgets/category_chip.dart';
import 'package:foodybite/view/widgets/heading_bar.dart';
import 'package:foodybite/view/widgets/review_tile.dart';
import 'package:foodybite/view/widgets/round_button.dart';
import 'package:get/get.dart';
import 'package:glassmorphism/glassmorphism.dart';
class RestaurantPage extends StatelessWidget {
const RestaurantPage({
@required this.restaurant,
this.isBookmarked = false,
});
final Restaurant restaurant;
final bool isBookmarked;
@override
Widget build(BuildContext context) {
return Scaffold(
extendBodyBehindAppBar: true,
appBar: MAppBar(
title: '',
appBar: AppBar(),
txtColor: Colors.white,
bgColor: Colors.transparent,
actions: [
IconButton(
icon: const Icon(Icons.share),
onPressed: () {},
),
IconButton(
icon: Icon(isBookmarked ? Icons.bookmark : Icons.bookmark_outline),
onPressed: () {},
)
],
),
body: SizedBox.expand(
child: Stack(
children: [
SizedBox(
height: SizeConfig.screenHeight,
width: SizeConfig.screenWidth,
child: SingleChildScrollView(
child: Column(
children: [
RestTopTile(imgPath: restaurant.displayFoodImg),
RestInfoTile(restaurant: restaurant),
const SizedBox(height: defaultPadding / 2),
const MenuPhotoBar(),
const SizedBox(height: defaultPadding * 2),
HeadinBar(
label: Values.review_n_ratings.tr,
count: '32',
onTap: () {
Get.to(() => const ReviewRatingPage(
showMyRatings: false,
));
}),
const SizedBox(
height: defaultPadding,
),
ReviewTile(
review: reviewList[0],
),
ReviewTile(review: reviewList[1]),
const SizedBox(height: defaultPadding * 3),
],
),
),
),
if (!isBookmarked)
Positioned(
bottom: 0,
right: 0,
left: 0,
child: RoundButton(
label: Values.rate_your_experience.tr,
onTap: () {
Get.to(
() => AddReviewPage(),
);
}),
),
],
),
),
);
}
}
class MenuPhotoBar extends StatelessWidget {
const MenuPhotoBar({
Key key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
final foodPhotos = foodsImgList.getRange(0, 3).toList();
return Column(
children: [
HeadinBar(
label: Values.menu_n_photos.tr,
count: '25',
onTap: () {
Get.to(() => const MenuPhotoPage());
}),
const SizedBox(height: defaultPadding / 2),
SizedBox(
height: getRelativeWidth(0.35),
child: ListView.builder(
itemCount: foodPhotos.length + 1,
scrollDirection: Axis.horizontal,
itemBuilder: (_, index) {
return index < foodPhotos.length
? Padding(
padding: EdgeInsets.only(
right: Get.locale.languageCode == 'ar'
? defaultPadding
: 0,
left: Get.locale.languageCode == 'ar'
? 0
: defaultPadding,
),
child: GestureDetector(
onTap: () {
Get.to(() => PhotoViewPage(index: index));
},
child: SizedBox(
height: getRelativeWidth(0.35),
width: getRelativeWidth(0.4),
child: ClipRRect(
borderRadius:
BorderRadius.circular(defaultBorderRadius),
child: Image.asset(foodPhotos[index],
fit: BoxFit.cover),
),
),
),
)
: const SizedBox(
width: defaultPadding,
);
}),
),
],
);
}
}
class RestTopTile extends StatelessWidget {
final String imgPath;
const RestTopTile({@required this.imgPath});
@override
Widget build(BuildContext context) {
return SizedBox(
height: getRelativeHeight(0.38),
width: getRelativeWidth(1),
child: Stack(
children: [
SizedBox.expand(
child: Image.asset(imgPath, fit: BoxFit.cover),
),
Positioned(
bottom: defaultPadding,
right: defaultPadding * 2,
left: defaultPadding * 2,
// ignore: missing_required_param
child: GlassmorphicContainer(
height: 45,
borderRadius: 30,
blur: 4,
alignment: Alignment.bottomCenter,
border: 0,
linearGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Colors.black.withOpacity(0.15),
Colors.black.withOpacity(0.05),
],
stops: const [
0.1,
1,
]),
borderGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Colors.white.withOpacity(0.15),
Colors.white.withOpacity(0.5),
],
),
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const CircleAvatar(
radius: 13,
backgroundColor: Colors.white,
child: Icon(
Icons.call,
size: 14,
color: primaryColor,
)),
const SizedBox(
width: defaultPadding / 2,
),
const Text('+1 212-673-3754',
style: TextStyle(color: Colors.white)),
const VerticalDivider(
color: Colors.white,
width: defaultPadding * 2,
),
const CircleAvatar(
radius: 13,
backgroundColor: Colors.white,
child: Icon(
Icons.alt_route,
size: 16,
color: primaryColor,
)),
const SizedBox(
width: defaultPadding / 2,
),
Text(
Values.direction.tr,
style: const TextStyle(
color: Colors.white,
),
)
],
),
)),
),
],
),
);
}
}
class RestInfoTile extends StatelessWidget {
const RestInfoTile({
Key key,
@required this.restaurant,
}) : super(key: key);
final Restaurant restaurant;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(defaultPadding),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Text(restaurant.name,
style: Theme.of(context).textTheme.subtitle1.copyWith(
color: textColor,
fontWeight: FontWeight.w800,
)),
const SizedBox(
width: 6,
),
CategoryChip(category: restaurant.category),
const SizedBox(
width: 6,
),
Container(
padding: const EdgeInsets.symmetric(
horizontal: defaultPadding * 0.55,
vertical: defaultPadding * 0.2,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(defaultBorderRadius),
color: primaryColor,
),
child: Text(
'1.2 km',
style: Theme.of(context).textTheme.caption.copyWith(
color: Colors.white,
fontSize: 10,
),
)),
const Spacer(),
RatingChip(
rating: restaurant.totalRating,
),
],
),
const SizedBox(
height: defaultPadding / 2,
),
Text(
restaurant.address,
style: Theme.of(context)
.textTheme
.caption
.copyWith(color: secondaryTextColor),
),
const SizedBox(
height: defaultPadding / 3,
),
RichText(
text: TextSpan(
text: Values.open_now.tr,
style: Theme.of(context)
.textTheme
.caption
.copyWith(color: Colors.green),
children: [
TextSpan(
text: ' ' + Values.daily_time.tr,
style: Theme.of(context)
.textTheme
.caption
.copyWith(color: Colors.grey),
),
TextSpan(
text: ' 09:30 am to 11:00 pm',
style: Theme.of(context)
.textTheme
.caption
.copyWith(color: Colors.red),
),
]),
),
],
),
);
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view/pages/HomeFlow | mirrored_repositories/FlutterFoodyBite/lib/view/pages/HomeFlow/Home/home_page.dart | import 'package:carousel_slider/carousel_slider.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/constants/values.dart';
import 'package:foodybite/models/data.dart';
import 'package:foodybite/models/restaurant_model.dart';
import 'package:foodybite/utils/size_config.dart';
import 'package:foodybite/view/pages/HomeFlow/Category/category_page.dart';
import 'package:foodybite/view/pages/HomeFlow/Filter/filter_page.dart';
import 'package:foodybite/view/pages/HomeFlow/Trending/trending_restaurants_page.dart';
import 'package:foodybite/view/pages/ProfilenSettingFlow/Profile/profile_page.dart';
import 'package:foodybite/view/pages/ProfilenSettingFlow/UserListing/user_listing_page.dart';
import 'package:foodybite/view/widgets/category_tile.dart';
import 'package:foodybite/view/widgets/heading_bar.dart';
import 'package:foodybite/view/widgets/restaurant_tile.dart';
import 'package:foodybite/view/widgets/search_field.dart';
import 'package:get/get.dart';
class HomePage extends StatefulWidget {
const HomePage({Key key}) : super(key: key);
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
final _searchController = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: SizedBox.expand(
child: SingleChildScrollView(
child: Column(
children: [
SizedBox(
height: getRelativeHeight(0.04),
),
SearchField(
controller: _searchController,
hint: Values.find_restaurants.tr,
onLeadingTap: () {
Get.to(() => FilterPage());
},
),
const SizedBox(
height: defaultPadding * 2,
),
HeadinBar(
label: Values.trending_restaurants.tr,
count: '29',
onTap: () {
Get.to(
() => const TrendingRestarurantsPage(),
);
},
),
const SizedBox(height: defaultPadding / 2),
SizedBox(
height: getRelativeWidth(0.62),
width: getRelativeWidth(1),
child: CarouselSlider.builder(
options: CarouselOptions(
viewportFraction: 0.91,
reverse: true,
height: getRelativeWidth(0.62),
),
itemCount: restaurantList.length,
itemBuilder: (_, index, __) {
return SizedBox(
width: getRelativeWidth(0.9),
child: RestaurantTile(
restaurant: restaurantList[index],
margin: const EdgeInsets.only(
right: defaultPadding,
bottom: 3,
),
),
);
}),
),
// SizedBox(
// height: getRelativeWidth(0.62),
// width: getRelativeWidth(1),
// child: ListView.builder(
// scrollDirection: Axis.horizontal,
// itemCount: restaurantList.length + 1,
//
// itemBuilder: (_, index) {
// return index < restaurantList.length
// ? SizedBox(
// width: getRelativeWidth(0.9),
// child: RestaurantTile(
// restaurant: restaurantList[index],
// margin: const EdgeInsets.only(
// left: defaultPadding,
// bottom: 3,
// ),
// ),
// )
// : const SizedBox(
// width: defaultPadding,
// );
// }),
// ),
const SizedBox(
height: defaultPadding * 2,
),
HeadinBar(
label: Values.categories.tr,
count: '9',
onTap: () {
Get.to(
() => const CategorySelectorPage(),
);
},
),
const SizedBox(height: defaultPadding / 2),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: defaultPadding,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
CategoryTile(
category: FCategory.italian,
),
CategoryTile(
category: FCategory.chinese,
),
CategoryTile(
category: FCategory.thai,
),
],
),
),
const SizedBox(
height: defaultPadding * 2,
),
HeadinBar(
label: Values.friends.tr,
count: '56',
onTap: () {
Get.to(
() => UserListingPage(
isFollowing: true,
appBarTitle: Values.following.tr,
userList: userList),
);
},
),
const SizedBox(height: defaultPadding / 2),
SizedBox(
height: 80,
width: getRelativeWidth(1),
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: userList.length > 6 ? 6 : userList.length,
itemBuilder: (_, index) {
return Align(
alignment: Alignment.topCenter,
child: Padding(
padding: EdgeInsets.only(
left: Get.locale.languageCode == 'ar'
? 0
: defaultPadding,
right: Get.locale.languageCode == 'ar'
? defaultPadding
: 0,
),
child: GestureDetector(
onTap: () {
Get.to(
() => ProfilePage(
isMe: false,
user: userList[index],
),
);
},
child: CircleAvatar(
radius: 30,
backgroundImage: AssetImage(
userList[index].imgPath,
),
),
),
),
);
},
),
),
SizedBox(
height: getRelativeHeight(0.12),
),
],
),
),
),
));
}
@override
void dispose() {
_searchController.dispose();
super.dispose();
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view/pages/HomeFlow | mirrored_repositories/FlutterFoodyBite/lib/view/pages/HomeFlow/MenuPhoto/menu_photo_page.dart | import 'package:flutter/material.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/constants/values.dart';
import 'package:foodybite/models/data.dart';
import 'package:foodybite/utils/size_config.dart';
import 'package:foodybite/view/pages/HomeFlow/PhotoView/photo_view_page.dart';
import 'package:foodybite/view/widgets/app_bar.dart';
import 'package:get/get.dart';
class MenuPhotoPage extends StatelessWidget {
const MenuPhotoPage({Key key}) : super(key: key);
final _tileCounts = const [
StaggeredTile.count(1, 1),
StaggeredTile.count(1, 1),
StaggeredTile.count(1, 1),
StaggeredTile.count(1, 1),
StaggeredTile.count(2, 2),
StaggeredTile.count(1, 1),
StaggeredTile.count(1, 1),
StaggeredTile.count(1, 1),
StaggeredTile.count(1, 1),
StaggeredTile.count(3, 2),
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MAppBar(
title: Values.menu_n_photos.tr,
appBar: AppBar(),
),
body: Container(
height: SizeConfig.screenHeight,
width: SizeConfig.screenWidth,
padding: const EdgeInsets.symmetric(
horizontal: defaultPadding,
),
child: StaggeredGridView.countBuilder(
crossAxisCount: 3,
itemCount: foodsImgList.length,
itemBuilder: (BuildContext context, int index) {
return GestureDetector(
onTap: () {
Get.to(() => PhotoViewPage(
index: index,
));
},
child: Hero(
tag: foodsImgList[index],
transitionOnUserGestures: true,
child: ClipRRect(
borderRadius: BorderRadius.circular(defaultBorderRadius),
child: Image.asset(
foodsImgList[index],
fit: BoxFit.cover,
),
),
),
);
},
staggeredTileBuilder: (int index) => _tileCounts[index % 10],
mainAxisSpacing: defaultPadding / 2,
crossAxisSpacing: defaultPadding / 2,
),
),
);
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view/pages/HomeFlow | mirrored_repositories/FlutterFoodyBite/lib/view/pages/HomeFlow/Category/category_page.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/constants/values.dart';
import 'package:foodybite/models/restaurant_model.dart';
import 'package:foodybite/utils/size_config.dart';
import 'package:foodybite/view/widgets/app_bar.dart';
import 'package:foodybite/view/widgets/category_tile.dart';
import 'package:get/get.dart';
class CategorySelectorPage extends StatelessWidget {
const CategorySelectorPage({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MAppBar(
title: Values.category.tr,
appBar: AppBar(),
),
body: SizedBox.expand(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: defaultPadding,
),
child: ListView.builder(
itemCount: FCategory.values.length,
itemBuilder: (_, index) {
final _category = FCategory.values[index];
return Padding(
padding: const EdgeInsets.only(
bottom: defaultPadding,
),
child: CategoryTile(
height: 80,
width: getRelativeWidth(1),
category: _category,
showDivider: true,
),
);
},
),
),
),
);
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view/pages/HomeFlow | mirrored_repositories/FlutterFoodyBite/lib/view/pages/HomeFlow/Category/category_restaurants_page.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/colors.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/constants/images.dart';
import 'package:foodybite/models/data.dart';
import 'package:foodybite/models/restaurant_model.dart';
import 'package:foodybite/utils/size_config.dart';
import 'package:foodybite/view/widgets/app_bar.dart';
import 'package:foodybite/view/widgets/no_restaurant.dart';
import 'package:foodybite/view/widgets/restaurant_tile.dart';
import 'package:get/get.dart';
class CategoryRestaurantsPage extends StatefulWidget {
const CategoryRestaurantsPage({@required this.category});
final FCategory category;
@override
_CategoryRestaurantsPageState createState() =>
_CategoryRestaurantsPageState();
}
class _CategoryRestaurantsPageState extends State<CategoryRestaurantsPage> {
PageController _pageController;
int _currentPage;
FCategory _currentCategory;
@override
void initState() {
super.initState();
_currentCategory = widget.category;
_currentPage = FCategory.values.indexOf(widget.category);
_pageController = PageController(initialPage: _currentPage);
}
@override
Widget build(BuildContext context) {
final List<Color> _colors = getCategoryGradient(widget.category).colors;
return Scaffold(
extendBodyBehindAppBar: true,
appBar: MAppBar(
title: _currentCategory.toString().split('.').last.tr,
appBar: AppBar(),
txtColor: Colors.white,
bgColor: Colors.transparent,
),
body: Column(
children: [
SizedBox(
height: 105,
width: getRelativeWidth(1),
child: Stack(
alignment: Alignment.center,
children: [
SizedBox(
height: 105,
width: getRelativeWidth(1),
child: Image.asset(
Images.getCategoryImage(_currentCategory),
fit: BoxFit.cover,
),
),
Container(
height: 105,
width: getRelativeWidth(1),
decoration: BoxDecoration(
gradient: LinearGradient(colors: [
_colors.first.withOpacity(0.5),
_colors.last.withOpacity(0.5),
]),
),
),
Positioned(
bottom: defaultPadding / 2,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: FCategory.values.map((e) {
return Container(
margin: const EdgeInsets.only(right: 4),
height: 4,
width: 20,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: e == _currentCategory
? Colors.white
: Colors.white.withOpacity(0.5),
),
);
}).toList(),
)),
],
),
),
Expanded(
child: MediaQuery.removePadding(
context: context,
removeTop: true,
child: PageView.builder(
controller: _pageController,
onPageChanged: (value) {
setState(() {
_currentCategory = FCategory.values[value];
});
},
itemCount: FCategory.values.length,
itemBuilder: (_, index) {
final _restaurants = restaurantList
.where(
(r) => r.category == FCategory.values[index],
)
.toList();
return _restaurants.length > 0
? ListView.builder(
itemCount: _restaurants.length + 1,
itemBuilder: (BuildContext context, int index) {
return index < _restaurants.length
? RestaurantTile(
restaurant: _restaurants[index],
)
: const SizedBox(height: defaultPadding * 2);
},
)
: const NoRestaurantTile(
title: 'No Restaurant found with this category.',
subtitle:
'Try searching again with other categories.',
);
}),
),
),
],
),
);
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view/pages/HomeFlow | mirrored_repositories/FlutterFoodyBite/lib/view/pages/HomeFlow/PhotoView/photo_view_page.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/colors.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/constants/values.dart';
import 'package:foodybite/models/data.dart';
import 'package:foodybite/view/widgets/app_bar.dart';
import 'package:get/get.dart';
import 'package:photo_view/photo_view.dart';
class PhotoViewPage extends StatefulWidget {
const PhotoViewPage({@required this.index});
final int index;
@override
_PhotoViewPageState createState() => _PhotoViewPageState();
}
class _PhotoViewPageState extends State<PhotoViewPage> {
PageController _pageController;
int _currentPage;
@override
void initState() {
super.initState();
_currentPage = widget.index;
_pageController = PageController(initialPage: _currentPage);
}
@override
Widget build(BuildContext context) {
return Scaffold(
extendBodyBehindAppBar: true,
appBar: MAppBar(
title: Values.preview.tr,
txtColor: Colors.white,
bgColor: Colors.transparent,
appBar: AppBar(),
),
body: SizedBox.expand(
child: Stack(
alignment: Alignment.center,
children: [
PageView(
controller: _pageController,
onPageChanged: (value) {
setState(() {
_currentPage = value;
});
},
children: foodsImgList.map((img) {
return Hero(
tag: img,
transitionOnUserGestures: true,
child: PhotoView(
backgroundDecoration: const BoxDecoration(
color: Color(0xFF25262E),
),
imageProvider: AssetImage(img),
),
);
}).toList(),
),
Positioned(
bottom: defaultPadding,
child: SizedBox(
height: 15,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
for (var i = 0; i < foodsImgList.length; i++)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 2),
child: CircleAvatar(
radius: _currentPage == i ? 5 : 3,
backgroundColor: _currentPage == i
? Colors.white
: Colors.transparent,
child: CircleAvatar(
radius: _currentPage == i ? 4 : 3,
backgroundColor: _currentPage == i
? primaryColor
: Colors.white24,
),
),
)
],
),
)),
],
),
),
);
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view/pages/AuthFlow | mirrored_repositories/FlutterFoodyBite/lib/view/pages/AuthFlow/Splash/splash_page.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/colors.dart';
import 'package:foodybite/constants/images.dart';
import 'package:foodybite/view/pages/AuthFlow/Login/login_page.dart';
import 'package:get/get.dart';
class SplashPage extends StatefulWidget {
@override
_SplashPageState createState() => _SplashPageState();
}
class _SplashPageState extends State<SplashPage> with TickerProviderStateMixin {
AnimationController _animationController;
AnimationController _slideAnimationController;
Animation<Offset> _slideAnimation;
Animation<double> _rotateAnimation;
Animation<double> _scaleAnimation;
@override
void initState() {
super.initState();
Future.delayed(const Duration(milliseconds: 1300), () {
_slideAnimationController.forward();
});
Future.delayed(const Duration(milliseconds: 2300), () {
Get.off(
() => LoginPage(),
);
});
_slideAnimationController = AnimationController(
duration: const Duration(milliseconds: 700),
vsync: this,
);
_animationController = AnimationController(
duration: const Duration(milliseconds: 1100),
vsync: this,
)..forward();
_slideAnimation = Tween<Offset>(
begin: const Offset(0, 10),
end: Offset.zero,
).animate(CurvedAnimation(
parent: _slideAnimationController,
curve: Curves.linear,
));
_rotateAnimation = Tween<double>(
begin: -0.06,
end: 0.01,
).animate(CurvedAnimation(
parent: _animationController,
curve: Curves.linear,
));
_scaleAnimation = Tween<double>(
begin: 1.2,
end: 1.45,
).animate(CurvedAnimation(
parent: _animationController,
curve: const Interval(0.5, 1),
));
}
@override
void dispose() {
super.dispose();
_animationController.dispose();
_slideAnimationController.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: SizedBox.expand(
child: Stack(
alignment: Alignment.center,
children: [
SizedBox.expand(
child: RotationTransition(
turns: _rotateAnimation,
child: ScaleTransition(
scale: _scaleAnimation,
child: Image.asset(
Images.splash,
fit: BoxFit.cover,
),
),
),
),
SlideTransition(
position: _slideAnimation,
child: Text(
"Foodybite",
style: Theme.of(context).textTheme.headline2.copyWith(
color: textColor,
fontWeight: FontWeight.bold,
),
),
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view/pages/AuthFlow | mirrored_repositories/FlutterFoodyBite/lib/view/pages/AuthFlow/ForgotPass/forgot_pass_page.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/constants/icons.dart';
import 'package:foodybite/constants/images.dart';
import 'package:foodybite/constants/values.dart';
import 'package:foodybite/utils/size_config.dart';
import 'package:foodybite/utils/validators.dart';
import 'package:foodybite/view/widgets/app_bar.dart';
import 'package:foodybite/view/widgets/input_field.dart';
import 'package:foodybite/view/widgets/mbutton.dart';
import 'package:get/get.dart';
class ForgotPassPage extends StatefulWidget {
@override
_ForgotPassPageState createState() => _ForgotPassPageState();
}
class _ForgotPassPageState extends State<ForgotPassPage> {
final _emailController = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
extendBodyBehindAppBar: true,
appBar: MAppBar(
title: Values.forgot_password.tr,
appBar: AppBar(),
txtColor: Colors.white,
bgColor: Colors.transparent,
),
body: SizedBox.expand(
child: Stack(
children: [
SizedBox.expand(
child: Image.asset(
Images.login,
fit: BoxFit.cover,
),
),
SizedBox.expand(
child: Container(
color: Colors.black54,
)),
SizedBox.expand(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: defaultPadding * 2,
),
child: Column(
children: [
SizedBox(
height: getRelativeHeight(0.16),
),
Text(Values.enter_email_for_forgot_password.tr,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.headline6.copyWith(
color: Colors.white,
fontWeight: FontWeight.w300,
)),
SizedBox(
height: getRelativeHeight(0.06),
),
InputField(
hint: Values.email.tr,
controller: _emailController,
iconPath: MIcons.mail,
textInputType: TextInputType.emailAddress,
validator: (val) => Validators.emailValidator(val),
),
const Spacer(),
MButton(
label: Values.send.tr,
onTap: () {},
),
SizedBox(
height: getRelativeHeight(0.06),
),
],
),
),
),
],
),
));
}
@override
void dispose() {
super.dispose();
_emailController.dispose();
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view/pages/AuthFlow | mirrored_repositories/FlutterFoodyBite/lib/view/pages/AuthFlow/Register/register_page.dart | import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:foodybite/constants/colors.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/constants/icons.dart';
import 'package:foodybite/constants/images.dart';
import 'package:foodybite/constants/values.dart';
import 'package:foodybite/controllers/profile_controller.dart';
import 'package:foodybite/utils/size_config.dart';
import 'package:foodybite/utils/validators.dart';
import 'package:foodybite/view/Widgets/input_field.dart';
import 'package:foodybite/view/Widgets/mbutton.dart';
import 'package:foodybite/view/dialogs/m_dialogs.dart';
import 'package:foodybite/view/pages/AuthFlow/Login/login_page.dart';
import 'package:foodybite/view/pages/AuthFlow/Welcome/welcome_page.dart';
import 'package:get/get.dart';
import 'package:glassmorphism/glassmorphism.dart';
class RegisterPage extends StatefulWidget {
@override
_RegisterPageState createState() => _RegisterPageState();
}
class _RegisterPageState extends State<RegisterPage> {
final _emailController = TextEditingController();
final _nameController = TextEditingController();
final _passwordController = TextEditingController();
final _confirmPasswordController = TextEditingController();
final _registerFormKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
body: SizedBox.expand(
child: Stack(
children: [
SizedBox(
height: SizeConfig.screenHeight,
width: SizeConfig.screenWidth,
child: Image.asset(
Images.register,
fit: BoxFit.cover,
),
),
Container(
color: Colors.black54,
),
SizedBox(
height: SizeConfig.screenHeight,
width: SizeConfig.screenWidth,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: defaultPadding * 2,
),
child: Column(
children: [
SizedBox(
height: getRelativeHeight(0.04),
),
SizedBox(
height: getRelativeHeight(0.04),
),
GetBuilder<ProfileController>(
init: ProfileController(),
builder: (_con) {
return SizedBox(
height: getRelativeWidth(0.4),
width: getRelativeWidth(0.4),
child: Stack(
alignment: Alignment.center,
children: [
GlassmorphicContainer(
width: getRelativeWidth(0.4),
height: getRelativeWidth(0.4),
borderRadius: 120,
blur: 3,
alignment: Alignment.bottomCenter,
border: 0,
linearGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
const Color(0xFFffffff)
.withOpacity(0.15),
const Color(0xFFFFFFFF)
.withOpacity(0.05),
],
stops: const [
0.1,
1,
]),
borderGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Colors.white.withOpacity(0.15),
Colors.white.withOpacity(0.5),
],
),
child: _con.imageFile != null
? Container(
height: getRelativeWidth(0.4),
width: getRelativeWidth(0.4),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(120),
),
child: Image.file(
_con.imageFile,
fit: BoxFit.cover,
))
: Center(
child: SvgPicture.asset(
MIcons.user_o,
height: 50,
color: Colors.white,
),
),
),
Positioned(
right: 4,
bottom: 4,
child: GestureDetector(
onTap: () {
MDialogs.imagePickerDialog(
onCameraTap: () {
Get.back();
_con.getImageFromCamer();
},
onGalleryTap: () {
Get.back();
_con.getImageFromGallery();
},
);
},
child: Container(
height: 40,
width: 40,
decoration: BoxDecoration(
color: primaryColor,
shape: BoxShape.circle,
border: Border.all(
width: 2,
color: Colors.white,
)),
child: const Icon(
Icons.arrow_upward,
color: Colors.white,
)),
),
),
],
),
);
}),
Form(
key: _registerFormKey,
child: SizedBox(
height: getRelativeHeight(0.5),
child: ListView(
shrinkWrap: true,
children: [
SizedBox(height: getRelativeHeight(0.05)),
InputField(
controller: _nameController,
hint: Values.name.tr,
iconPath: MIcons.user_o,
),
const SizedBox(height: defaultPadding),
InputField(
textInputType: TextInputType.emailAddress,
controller: _emailController,
hint: Values.email.tr,
iconPath: MIcons.mail,
validator: (val) =>
Validators.emailValidator(val),
),
const SizedBox(height: defaultPadding),
InputField(
textInputType: TextInputType.visiblePassword,
isPassword: true,
controller: _passwordController,
hint: Values.password.tr,
iconPath: MIcons.lock,
validator: (val) =>
Validators.passwordValidator(val),
),
const SizedBox(height: defaultPadding),
InputField(
textInputType: TextInputType.visiblePassword,
isPassword: true,
controller: _confirmPasswordController,
hint: Values.confirm_password.tr,
iconPath: MIcons.lock,
validator: (val) =>
Validators.confirmPasswordValidator(
_passwordController.text, val),
),
SizedBox(
height: getRelativeHeight(0.14),
)
],
),
),
),
const Spacer(),
MButton(
label: Values.register.tr,
onTap: () {
//_validateInput();
Get.off(() => WelcomePage());
},
),
const SizedBox(height: defaultPadding * 3),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
Values.already_have_account.tr,
style:
Theme.of(context).textTheme.subtitle1.copyWith(
color: Colors.white,
fontWeight: FontWeight.w300,
),
),
GestureDetector(
onTap: () {
Get.off(() => LoginPage());
},
child: Text(
' ' + Values.login.tr,
style: Theme.of(context)
.textTheme
.subtitle1
.copyWith(
color: primaryColor,
fontWeight: FontWeight.w400,
decoration: TextDecoration.underline,
),
),
),
],
),
const SizedBox(height: defaultPadding),
],
),
),
),
],
),
));
}
void _validateInput() {
if (_registerFormKey.currentState.validate()) {}
}
@override
void dispose() {
super.dispose();
_nameController.dispose();
_emailController.dispose();
_passwordController.dispose();
_confirmPasswordController.dispose();
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view/pages/AuthFlow | mirrored_repositories/FlutterFoodyBite/lib/view/pages/AuthFlow/Welcome/welcome_page.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/constants/images.dart';
import 'package:foodybite/constants/values.dart';
import 'package:foodybite/utils/size_config.dart';
import 'package:foodybite/view/pages/RootPage/root_page.dart';
import 'package:foodybite/view/widgets/app_title.dart';
import 'package:foodybite/view/widgets/mbutton.dart';
import 'package:get/get.dart';
import 'package:glassmorphism/glassmorphism.dart';
class WelcomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
body: SizedBox.expand(
child: Stack(
children: [
SizedBox.expand(
child: Image.asset(
Images.welcome,
fit: BoxFit.cover,
),
),
SizedBox.expand(
child: Container(
color: Colors.black54,
)),
SizedBox.expand(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: defaultPadding,
),
child: Column(
children: [
SizedBox(
height: getRelativeHeight(0.04),
),
GestureDetector(
onTap: () {
Get.offAll(
() => RootPage(),
);
},
child: Align(
alignment: Alignment.centerRight,
child: GlassmorphicContainer(
width: 90,
height: 40,
borderRadius: 8,
blur: 3,
alignment: Alignment.bottomCenter,
border: 0,
linearGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
const Color(0xFFffffff).withOpacity(0.18),
const Color(0xFFFFFFFF).withOpacity(0.16),
],
stops: const [
0.1,
1,
]),
borderGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Colors.white.withOpacity(0.25),
Colors.white.withOpacity(0.25),
],
),
child: Center(
child: Text(Values.skip.tr,
style: Theme.of(context)
.textTheme
.subtitle1
.copyWith(
color: Colors.white,
fontWeight: FontWeight.w300,
)),
),
),
),
),
const Spacer(),
Text(
'''
${Values.hi.tr} John
${Values.welcome_to.tr}
''',
style: Theme.of(context).textTheme.headline3.copyWith(
color: Colors.white,
letterSpacing: 0.5,
fontWeight: FontWeight.bold,
height: 0.6,
),
),
Align(
alignment: Get.locale.languageCode == 'ar'
? Alignment.centerRight
: Alignment.centerLeft,
child: const AppTitle(color: Colors.yellow),
),
SizedBox(
height: getRelativeHeight(0.12),
),
Text(Values.please_turn_on_gps.tr,
textAlign: TextAlign.left,
style: Theme.of(context).textTheme.headline6.copyWith(
color: Colors.white,
fontWeight: FontWeight.w300,
)),
SizedBox(
height: getRelativeHeight(0.12),
),
MButton(
label: Values.turn_on_gps.tr,
onTap: () {},
),
SizedBox(
height: getRelativeHeight(0.06),
),
],
),
),
),
],
),
));
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view/pages/AuthFlow | mirrored_repositories/FlutterFoodyBite/lib/view/pages/AuthFlow/Login/login_page.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/constants/icons.dart';
import 'package:foodybite/constants/images.dart';
import 'package:foodybite/constants/values.dart';
import 'package:foodybite/utils/size_config.dart';
import 'package:foodybite/utils/validators.dart';
import 'package:foodybite/view/pages/AuthFlow/ForgotPass/forgot_pass_page.dart';
import 'package:foodybite/view/pages/AuthFlow/Register/register_page.dart';
import 'package:foodybite/view/pages/RootPage/root_page.dart';
import 'package:foodybite/view/widgets/app_title.dart';
import 'package:foodybite/view/widgets/input_field.dart';
import 'package:foodybite/view/widgets/mbutton.dart';
import 'package:get/get.dart';
class LoginPage extends StatefulWidget {
@override
_LoginPageState createState() => _LoginPageState();
}
class _LoginPageState extends State<LoginPage> {
final _emailController = TextEditingController();
final _passwordController = TextEditingController();
final _loginFormKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
body: SizedBox.expand(
child: Stack(
children: [
SizedBox.expand(
child: Image.asset(
Images.login,
fit: BoxFit.cover,
),
),
SizedBox.expand(
child: Container(
color: Colors.black54,
)),
SizedBox.expand(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: defaultPadding * 2,
),
child: Column(
children: [
SizedBox(
height: getRelativeHeight(0.15),
),
const AppTitle(color: Colors.white),
const Spacer(),
Form(
key: _loginFormKey,
child: Column(
children: [
InputField(
iconPath: MIcons.mail,
controller: _emailController,
hint: Values.email.tr,
validator: (val) =>
Validators.emailValidator(val),
),
const SizedBox(height: defaultPadding),
InputField(
iconPath: MIcons.lock,
controller: _passwordController,
isPassword: true,
hint: Values.password.tr,
validator: (val) =>
Validators.passwordValidator(val),
),
const SizedBox(height: defaultPadding),
],
),
),
Align(
alignment: Get.locale.languageCode == 'ar'
? Alignment.centerLeft
: Alignment.centerRight,
child: GestureDetector(
onTap: () {
Get.to(() => ForgotPassPage());
},
child: Text(
Values.forgot_password.tr,
style:
Theme.of(context).textTheme.bodyText1.copyWith(
color: Colors.white,
),
),
),
),
SizedBox(
height: getRelativeHeight(0.2),
),
MButton(
label: Values.login.tr,
onTap: () {
//inputValidation,
Get.off(() => RootPage());
},
),
const SizedBox(height: defaultPadding * 5),
GestureDetector(
onTap: () {
Get.off(() => RegisterPage());
},
child: Text(
Values.create_new_account.tr,
style: Theme.of(context).textTheme.subtitle1.copyWith(
color: Colors.white,
fontWeight: FontWeight.w300,
decoration: TextDecoration.underline,
),
),
),
const SizedBox(height: defaultPadding),
],
),
),
),
],
),
));
}
void inputValidation() {
if (_loginFormKey.currentState.validate()) {
print('validate');
}
}
@override
void dispose() {
super.dispose();
_emailController.dispose();
_passwordController.dispose();
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view/pages | mirrored_repositories/FlutterFoodyBite/lib/view/pages/Notifications/notifications_page.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/colors.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/constants/values.dart';
import 'package:foodybite/models/data.dart';
import 'package:foodybite/models/notification_model.dart';
import 'package:foodybite/utils/datetime_utils.dart';
import 'package:foodybite/view/widgets/app_bar.dart';
import 'package:get/get.dart';
class NotificationsPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MAppBar(
appBar: AppBar(),
title: Values.notifications.tr,
),
body: SizedBox.expand(
child: ListView.builder(
itemCount: notificationList.length + 1,
itemBuilder: (_, index) => index < notificationList.length
? NotificationTile(notification: notificationList[index])
: const SizedBox(
height: 100,
),
)),
);
}
}
class NotificationTile extends StatelessWidget {
const NotificationTile({@required this.notification});
final NotificationModel notification;
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.symmetric(horizontal: defaultPadding),
padding: const EdgeInsets.only(
bottom: defaultPadding / 2,
top: defaultPadding,
),
child: Row(
children: [
CircleAvatar(
radius: 26,
backgroundImage: AssetImage(notification.iconPath),
),
const SizedBox(
width: defaultPadding,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
notification.source,
style: Theme.of(context).textTheme.subtitle1.copyWith(
color: textColor,
fontWeight: FontWeight.w600,
),
),
Text(
DateTimeUtils.dateToString(notification.dateTime),
style: Theme.of(context).textTheme.caption.copyWith(
color: secondaryTextColor,
),
),
],
),
const SizedBox(
height: defaultPadding / 2,
),
Text(
notification.description,
style: Theme.of(context).textTheme.caption.copyWith(
color: secondaryTextColor,
),
),
],
),
),
],
),
);
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view/pages | mirrored_repositories/FlutterFoodyBite/lib/view/pages/NewReview/new_review_page.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/colors.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/constants/values.dart';
import 'package:foodybite/models/data.dart';
import 'package:foodybite/models/restaurant_model.dart';
import 'package:foodybite/view/widgets/app_bar.dart';
import 'package:foodybite/view/widgets/input_field.dart';
import 'package:foodybite/view/widgets/mbutton.dart';
import 'package:foodybite/view/widgets/no_restaurant.dart';
import 'package:foodybite/view/widgets/rating_bar.dart';
import 'package:foodybite/view/widgets/restaurant_tile.dart';
import 'package:foodybite/view/widgets/search_field.dart';
import 'package:get/get.dart';
class NewReviewPage extends StatefulWidget {
const NewReviewPage({
this.isUpdate = false,
});
final bool isUpdate;
@override
_NewReviewPageState createState() => _NewReviewPageState();
}
class _NewReviewPageState extends State<NewReviewPage> {
final _experienceController = TextEditingController();
final _searchController = TextEditingController();
Restaurant _restaurant;
bool restSelected = false;
@override
Widget build(BuildContext context) {
if (_searchController.text.length > 0) {
try {
_restaurant = restaurantList.firstWhere(
(r) => r.name.toLowerCase().trim().contains(
_searchController.text.toLowerCase().trim(),
),
);
} catch (e) {
_restaurant = null;
}
}
return Scaffold(
appBar: MAppBar(
title: widget.isUpdate ? Values.edit_review.tr : Values.new_review.tr,
appBar: AppBar(),
actions: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: defaultPadding),
child: Center(
child: GestureDetector(
onTap: () {},
child: Text(
Values.post.tr,
style: Theme.of(context).textTheme.subtitle1.copyWith(
color: primaryColor,
fontWeight: FontWeight.w600,
),
),
),
),
),
],
),
body: SizedBox.expand(
child: SingleChildScrollView(
child: Column(
children: [
const SizedBox(height: defaultPadding),
SearchField(
controller: _searchController,
hint: Values.search_restaurants.tr,
onFieldSubmitted: (value) {
setState(() {});
},
),
const SizedBox(height: defaultPadding),
_searchController.text.isNotEmpty
? _restaurant == null
? const NoRestaurantTile(
title: "No Restaurant found with "
"this name",
subtitle: 'Try searching again with different name '
'or make sure you entered correct name.',
)
: RestaurantTile(
closeTap: () {
setState(() {
_restaurant = null;
_searchController.clear();
restSelected = false;
});
},
forAddReview: true,
selectedForReview: restSelected,
restaurant: _restaurant,
addReviewTap: restSelected
? () {}
: () {
setState(() {
restSelected = true;
});
},
)
: const SizedBox(),
const SizedBox(height: defaultPadding * 2),
Text(Values.ratings.tr,
style: const TextStyle(
color: Colors.black,
fontWeight: FontWeight.w600,
fontSize: 18,
)),
const SizedBox(height: defaultPadding),
RatingBar(initialRating: 0, onRatingChange: (val) {}),
const SizedBox(height: defaultPadding * 1),
Text(Values.rate_your_experience.tr,
style: TextStyle(
color: secondaryTextColor,
fontWeight: FontWeight.w600,
fontSize: 14,
)),
const SizedBox(height: defaultPadding * 2),
Text(Values.review.tr,
style: const TextStyle(
color: Colors.black,
fontWeight: FontWeight.w600,
fontSize: 18,
)),
const SizedBox(height: defaultPadding),
Padding(
padding: const EdgeInsets.symmetric(horizontal: defaultPadding),
child: InputField(
maxLines: 8,
isWhite: false,
hint: Values.write_your_experience.tr,
controller: _experienceController,
),
),
if (widget.isUpdate)
Padding(
padding: const EdgeInsets.fromLTRB(
defaultPadding, defaultPadding * 3, defaultPadding, 0),
child: MButton(
label: Values.update.tr,
onTap: () {},
),
),
const SizedBox(height: defaultPadding * 6),
],
),
)));
}
@override
void dispose() {
_searchController.dispose();
_experienceController.dispose();
super.dispose();
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view/pages | mirrored_repositories/FlutterFoodyBite/lib/view/pages/RootPage/root_page.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/icons.dart';
import 'package:foodybite/models/data.dart';
import 'package:foodybite/view/pages/Favourite/favourite_restaurants_page.dart';
import 'package:foodybite/view/pages/HomeFlow/Home/home_page.dart';
import 'package:foodybite/view/pages/NewReview/new_review_page.dart';
import 'package:foodybite/view/pages/Notifications/notifications_page.dart';
import 'package:foodybite/view/pages/ProfilenSettingFlow/Profile/profile_page.dart';
import 'package:foodybite/view/pages/RootPage/Components/bootm_nav_bar.dart';
class RootPage extends StatefulWidget {
@override
_RootPageState createState() => _RootPageState();
}
class _RootPageState extends State<RootPage> {
final _pages = [
const HomePage(),
FavouriteRestaurantsPage(),
const NewReviewPage(),
NotificationsPage(),
ProfilePage(
user: userList[0],
isMe: true,
),
];
int _selectedIndex = 0;
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
body: SizedBox.expand(
child: Stack(
children: [
_pages[_selectedIndex],
Positioned(
bottom: 0,
child: BottomNavigation(
onCenterTap: () {
setState(() {
_selectedIndex = _selectedIndex == 2 ? 0 : 2;
});
},
selectedIndex: _selectedIndex,
onItemPressed: (index) {
setState(() {
_selectedIndex = index;
});
},
centerIcon: _selectedIndex == 2 ? Icons.close : Icons.add,
iconsPath: [
_selectedIndex == 0 ? MIcons.home_f : MIcons.home_o,
_selectedIndex == 1 ? MIcons.bookmark_f : MIcons.bookmark_o,
_selectedIndex == 3 ? MIcons.bell_f : MIcons.bell_o,
_selectedIndex == 4 ? MIcons.user_f : MIcons.user_o,
],
),
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view/pages/RootPage | mirrored_repositories/FlutterFoodyBite/lib/view/pages/RootPage/Components/bootm_nav_bar.dart | import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:foodybite/constants/colors.dart';
import 'package:foodybite/utils/size_config.dart';
class BottomNavigation extends StatelessWidget {
final List<String> iconsPath;
final IconData centerIcon;
final int selectedIndex;
final Function(int) onItemPressed;
final VoidCallback onCenterTap;
const BottomNavigation({
Key key,
@required this.iconsPath,
@required this.onCenterTap,
@required this.centerIcon,
@required this.selectedIndex,
@required this.onItemPressed,
}) : assert(iconsPath.length != 3, "Item must equal 4");
@override
Widget build(BuildContext context) {
return Container(
color: Colors.transparent,
height: getRelativeHeight(0.11),
width: SizeConfig.screenWidth,
child: Stack(
children: [
Align(
alignment: Alignment.bottomCenter,
child: Container(
height: getRelativeHeight(0.072),
width: SizeConfig.screenWidth,
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30),
topRight: Radius.circular(30),
),
boxShadow: [
BoxShadow(
color: Colors.black12,
offset: Offset(0, -1),
blurRadius: 10,
),
],
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
BottomNavItem(
onItemPressed: onItemPressed,
iconPath: iconsPath[0],
selectedIndex: selectedIndex,
index: 0,
),
BottomNavItem(
onItemPressed: onItemPressed,
iconPath: iconsPath[1],
selectedIndex: selectedIndex,
index: 1,
size: 21,
),
SizedBox(
width: SizeConfig.screenWidth * 0.14,
),
BottomNavItem(
onItemPressed: onItemPressed,
iconPath: iconsPath[2],
selectedIndex: selectedIndex,
index: 3,
size: 24,
),
BottomNavItem(
onItemPressed: onItemPressed,
iconPath: iconsPath[3],
selectedIndex: selectedIndex,
index: 4,
),
],
),
),
),
Positioned.fill(
child: Align(
alignment: Alignment.topCenter,
child: GestureDetector(
onTap: onCenterTap,
child: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
boxShadow: [
BoxShadow(
blurRadius: 15,
offset: const Offset(0, 4),
color: primaryColor.withOpacity(0.75),
),
// BoxShadow(
// blurRadius: 25,
// offset: Offset(0, 5),
// color: primaryColor.withOpacity(0.75),
// )
],
color: primaryColor,
),
height: getRelativeWidth(0.15),
width: getRelativeWidth(0.15),
child: Center(
child: Icon(
centerIcon,
color: Colors.white,
size: getRelativeWidth(0.07),
)),
),
),
),
)
],
),
);
}
}
class BottomNavItem extends StatelessWidget {
const BottomNavItem({
@required this.onItemPressed,
@required this.iconPath,
@required this.index,
@required this.selectedIndex,
this.size = 22,
});
final Function(int p1) onItemPressed;
final String iconPath;
final int index, selectedIndex;
final double size;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
onItemPressed(index);
},
child: SizedBox(
width: SizeConfig.screenWidth * 0.18,
child: SvgPicture.asset(
iconPath,
height: size,
color: index == selectedIndex ? primaryColor : secondaryColor,
),
),
);
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view | mirrored_repositories/FlutterFoodyBite/lib/view/Widgets/rating_bar.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/colors.dart';
import 'package:foodybite/constants/consts.dart';
class RatingBar extends StatefulWidget {
const RatingBar({
@required this.onRatingChange,
@required this.initialRating,
});
final ValueChanged<int> onRatingChange;
final int initialRating;
@override
_RatingBarState createState() => _RatingBarState();
}
class _RatingBarState extends State<RatingBar> {
int _rating = 0;
@override
void initState() {
_rating = widget.initialRating;
super.initState();
}
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(
horizontal: defaultPadding,
vertical: defaultPadding / 2,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(defaultBorderRadius / 2),
color: ratingBarColor,
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
for (var i = 1; i <= 5; i++)
GestureDetector(
onTap: () {
setState(() {
_rating = i;
widget.onRatingChange(_rating);
});
},
child: Icon(
Icons.star,
color: i <= _rating ? ratingStarColor : Colors.grey[300],
size: 52,
),
),
],
),
);
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view | mirrored_repositories/FlutterFoodyBite/lib/view/Widgets/input_field.dart | import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:foodybite/constants/colors.dart';
class InputField extends StatefulWidget {
const InputField({
@required this.hint,
this.validator,
@required this.controller,
this.iconPath,
this.isPassword = false,
this.textInputType = TextInputType.text,
this.isWhite = true,
this.maxLines = 1,
});
final String hint, iconPath;
final Function validator;
final TextEditingController controller;
final bool isPassword, isWhite;
final TextInputType textInputType;
final int maxLines;
@override
_InputFieldState createState() => _InputFieldState();
}
class _InputFieldState extends State<InputField> {
bool _hidePass = true;
@override
Widget build(BuildContext context) {
return TextFormField(
controller: widget.controller,
validator: widget.validator ??
(val) {
if (val.isEmpty || val == null) {
return 'Required';
} else {
return null;
}
},
textAlignVertical: TextAlignVertical.center,
style: Theme.of(context).textTheme.bodyText1.copyWith(
color: widget.isWhite ? Colors.white : Colors.black,
),
maxLines: widget.maxLines,
cursorColor: widget.isWhite ? Colors.white : Colors.black,
autovalidateMode: AutovalidateMode.onUserInteraction,
obscureText: widget.isPassword ? _hidePass : false,
decoration: InputDecoration(
hintText: widget.hint,
hintStyle: Theme.of(context).textTheme.subtitle2.copyWith(
color: widget.isWhite ? Colors.white : secondaryTextColor,
),
prefixIcon: widget.iconPath != null
? Transform.scale(
scale: 0.4,
child: SvgPicture.asset(
widget.iconPath,
color: !widget.isWhite ? primaryColor : Colors.white,
height: 12,
),
)
: null,
suffixIcon: widget.isPassword
? GestureDetector(
onTap: () {
setState(() {
_hidePass = !_hidePass;
});
},
child: Icon(
Icons.remove_red_eye,
color: !_hidePass ? primaryColor : secondaryColor,
),
)
: null,
filled: true,
fillColor: widget.isWhite ? textFieldColor : Colors.white,
enabledBorder: OutlineInputBorder(
borderSide: widget.isWhite
? BorderSide.none
: BorderSide(
color: secondaryTextColor,
),
borderRadius: BorderRadius.circular(12),
),
focusedBorder: OutlineInputBorder(
borderSide: widget.isWhite
? BorderSide.none
: BorderSide(
color: secondaryTextColor,
),
borderRadius: BorderRadius.circular(12),
),
),
);
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view | mirrored_repositories/FlutterFoodyBite/lib/view/Widgets/category_tile.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/colors.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/constants/images.dart';
import 'package:foodybite/models/restaurant_model.dart';
import 'package:foodybite/utils/size_config.dart';
import 'package:foodybite/view/pages/HomeFlow/Category/category_restaurants_page.dart';
import 'package:get/get.dart';
class CategoryTile extends StatelessWidget {
CategoryTile({
@required this.category,
this.height,
this.width,
this.showDivider = false,
});
final FCategory category;
double height, width;
bool showDivider;
@override
Widget build(BuildContext context) {
final List<Color> _colors = getCategoryGradient(category).colors;
height = height ?? getRelativeWidth(0.28);
width = width ?? getRelativeWidth(0.28);
return GestureDetector(
onTap: () {
Get.to(
() => CategoryRestaurantsPage(
category: category,
),
);
},
child: Container(
height: height,
width: width,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(defaultBorderRadius),
),
child: Stack(
alignment: Alignment.center,
children: [
SizedBox(
height: height,
width: width,
child: ClipRRect(
borderRadius: BorderRadius.circular(defaultBorderRadius),
child: Image.asset(
Images.getCategoryImage(category),
fit: BoxFit.cover,
),
),
),
Container(
height: height,
width: width,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(defaultBorderRadius),
gradient: LinearGradient(colors: [
_colors.first.withOpacity(0.5),
_colors.last.withOpacity(0.5),
]),
),
),
Text(
category.toString().split('.').last.tr,
style: Theme.of(context).textTheme.headline6.copyWith(
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
if (showDivider)
Positioned(
right: defaultPadding,
child: Container(
height: 30,
width: 5,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
color: Colors.white.withOpacity(0.5),
)),
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view | mirrored_repositories/FlutterFoodyBite/lib/view/Widgets/mbutton.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/colors.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/utils/size_config.dart';
class MButton extends StatelessWidget {
const MButton({
this.txtSize,
this.height,
this.width,
@required this.label,
@required this.onTap,
this.isFilled = true,
});
final String label;
final VoidCallback onTap;
final double height, width, txtSize;
final bool isFilled;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onTap,
child: Container(
height: height ?? 55,
width: width ?? getRelativeWidth(1),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(defaultBorderRadius),
border: isFilled
? null
: Border.all(
color: secondaryColor,
),
color: isFilled ? primaryColor : Colors.white,
),
child: Center(
child: Text(
label,
style: Theme.of(context).textTheme.bodyText1.copyWith(
color: isFilled ? Colors.white : secondaryColor,
fontSize: txtSize ?? 14,
),
),
),
),
);
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view | mirrored_repositories/FlutterFoodyBite/lib/view/Widgets/heading_bar.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/colors.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/constants/values.dart';
import 'package:get/get.dart';
class HeadinBar extends StatelessWidget {
const HeadinBar({
Key key,
@required this.label,
@required this.count,
@required this.onTap,
}) : super(key: key);
final String label, count;
final VoidCallback onTap;
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.only(
bottom: defaultPadding / 2,
),
padding: const EdgeInsets.symmetric(horizontal: defaultPadding),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
label,
style: Theme.of(context).textTheme.headline6.copyWith(
color: textColor,
fontWeight: FontWeight.w600,
),
),
GestureDetector(
onTap: onTap,
child: Text(Values.see_all.tr + ' ($count)',
style: Theme.of(context).textTheme.subtitle2.copyWith(
color: secondaryTextColor,
)),
)
],
));
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view | mirrored_repositories/FlutterFoodyBite/lib/view/Widgets/restaurant_tile.dart | import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:foodybite/constants/colors.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/constants/icons.dart';
import 'package:foodybite/constants/values.dart';
import 'package:foodybite/models/data.dart';
import 'package:foodybite/models/restaurant_model.dart';
import 'package:foodybite/utils/size_config.dart';
import 'package:foodybite/view/pages/HomeFlow/Restaurant/restaurant_page.dart';
import 'package:foodybite/view/widgets/review_tile.dart';
import 'package:get/get.dart';
import 'category_chip.dart';
class RestaurantTile extends StatelessWidget {
const RestaurantTile({
@required this.restaurant,
this.forAddReview = false,
this.selectedForReview = false,
this.forFavourite = false,
this.forProfile = false,
this.menuTap,
this.closeTap,
this.addReviewTap,
this.margin = const EdgeInsets.fromLTRB(
defaultPadding, defaultPadding, defaultPadding, 0),
});
final bool forAddReview, forFavourite, forProfile, selectedForReview;
final Restaurant restaurant;
final EdgeInsetsGeometry margin;
final VoidCallback menuTap, addReviewTap, closeTap;
@override
Widget build(BuildContext context) {
const int noOfFriends = 2;
const int circleLimit = noOfFriends > 4 ? 4 : noOfFriends;
const int more = noOfFriends - 4 > 0 ? noOfFriends - 4 : 0;
return GestureDetector(
onTap: () {
Get.to(() => RestaurantPage(
restaurant: restaurant,
isBookmarked: forFavourite,
));
},
child: Container(
margin: margin,
height: getRelativeWidth(0.62),
width: getRelativeWidth(1),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(defaultBorderRadius),
color: Colors.white,
boxShadow: const [
BoxShadow(
color: Colors.black12,
offset: Offset(0, 1),
blurRadius: 2,
),
]),
child: Stack(
children: [
Positioned(
top: 0,
right: 0,
left: 0,
child: SizedBox(
height: getRelativeWidth(0.45),
width: getRelativeWidth(1),
child: Stack(
children: [
SizedBox.expand(
child: ClipRRect(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(defaultBorderRadius),
topRight: Radius.circular(defaultBorderRadius),
),
child: Image.asset(
restaurant.displayFoodImg,
fit: BoxFit.cover,
),
),
),
if (!forAddReview)
Positioned(
top: defaultPadding,
right: defaultPadding,
child: RatingChip(
rating: restaurant.totalRating,
),
),
if (forAddReview)
Positioned(
top: defaultPadding,
right: Get.locale.languageCode == 'ar'
? null
: defaultPadding,
left: Get.locale.languageCode == 'ar'
? defaultPadding
: null,
child: GestureDetector(
onTap: closeTap,
child: const CircleAvatar(
backgroundColor: Colors.white,
radius: 12,
child: Icon(
Icons.close,
size: 18,
color: Colors.redAccent,
),
),
)),
if (!forAddReview)
Positioned(
top: defaultPadding,
left: defaultPadding,
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: defaultPadding / 2,
vertical: defaultPadding / 6,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(
defaultBorderRadius / 2),
boxShadow: const [
BoxShadow(
color: Colors.black12,
offset: Offset(1, 2),
blurRadius: 5,
)
]),
child: Center(
child: Text(
restaurant.isOpen
? Values.open.tr
: Values.close.tr,
style: TextStyle(
color: restaurant.isOpen
? Colors.green
: Colors.red,
height: 1.2,
fontSize: 12,
fontWeight: FontWeight.w500,
),
),
),
)),
],
)),
),
Positioned(
bottom: 0,
right: 0,
left: 0,
child: SizedBox(
height: getRelativeWidth(0.15),
width: getRelativeWidth(1),
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: defaultPadding / 2,
vertical: defaultPadding / 2,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Text(restaurant.name,
style: Theme.of(context)
.textTheme
.subtitle1
.copyWith(
color: textColor,
fontWeight: FontWeight.w800,
)),
const SizedBox(
width: 6,
),
CategoryChip(category: restaurant.category),
const SizedBox(
width: 6,
),
if (!forProfile && !forFavourite)
Container(
padding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 4,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
defaultBorderRadius),
color: primaryColor,
),
child: Text(
'1.2 km',
style: Theme.of(context)
.textTheme
.caption
.copyWith(
color: Colors.white,
fontSize: 8,
),
)),
const Spacer(),
if (!forFavourite && !forAddReview)
SizedBox(
height: 25,
width: 100,
child: Stack(
alignment: Get.locale.languageCode == 'ar'
? Alignment.centerLeft
: Alignment.centerRight,
children: [
for (var i = 0; i < circleLimit; i++)
ImageCircle(
imgPath: userList[i].imgPath,
circleNo: i,
more: i == 0 ? more : 0,
),
])),
if (forProfile)
GestureDetector(
onTap: menuTap,
child: const Icon(Icons.more_vert,
color: textColor),
),
],
),
Text(
restaurant.address,
style: Theme.of(context)
.textTheme
.caption
.copyWith(color: secondaryTextColor),
)
],
),
),
),
),
if (forFavourite)
Positioned(
left: Get.locale.languageCode == 'ar' ? defaultPadding : null,
right:
Get.locale.languageCode == 'ar' ? null : defaultPadding,
bottom: getRelativeWidth(0.12),
child: CircleAvatar(
radius: 20,
backgroundColor: Colors.white,
child: SvgPicture.asset(
MIcons.bookmark_f,
height: 16,
color: primaryColor,
),
),
),
if (forAddReview)
Positioned(
right:
Get.locale.languageCode == 'ar' ? null : defaultPadding,
left: Get.locale.languageCode == 'ar' ? defaultPadding : null,
bottom: defaultPadding,
child: GestureDetector(
onTap: addReviewTap,
child: CircleAvatar(
radius: 18,
backgroundColor:
selectedForReview ? Colors.green : primaryColor,
child: Icon(
selectedForReview ? Icons.done : Icons.add,
color: Colors.white,
),
),
),
),
],
)),
);
}
}
class ImageCircle extends StatelessWidget {
const ImageCircle({
@required this.imgPath,
this.circleNo = 0,
this.more = 0,
Key key,
}) : super(key: key);
final String imgPath;
final int circleNo;
final int more;
@override
Widget build(BuildContext context) {
return Positioned(
right: Get.locale.languageCode == 'ar' ? null : 20.0 * circleNo,
left: Get.locale.languageCode == 'ar' ? 20.0 * circleNo : null,
child: CircleAvatar(
radius: 13,
backgroundColor: Colors.white,
child: CircleAvatar(
radius: 12,
backgroundImage: AssetImage(imgPath),
child: Center(
child: Text(more == 0 ? '' : more.toString()),
)),
),
);
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view | mirrored_repositories/FlutterFoodyBite/lib/view/Widgets/review_tile.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/colors.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/models/review_model.dart';
class ReviewTile extends StatelessWidget {
const ReviewTile({
@required this.review,
this.isRestaurant = false,
});
final Review review;
final bool isRestaurant;
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.symmetric(horizontal: defaultPadding),
padding: const EdgeInsets.only(
bottom: defaultPadding * 1,
top: defaultPadding / 2,
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CircleAvatar(
radius: 22,
backgroundImage: AssetImage(
isRestaurant ? review.restaurantImgPath : review.userImgPath),
),
const SizedBox(
width: defaultPadding,
),
Expanded(
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
isRestaurant ? review.restaurantName : review.userName,
style: Theme.of(context).textTheme.subtitle1.copyWith(
color: textColor,
fontWeight: FontWeight.w600,
),
),
const Spacer(),
RatingChip(rating: review.rating),
],
),
const SizedBox(
height: defaultPadding / 2,
),
Text(
review.review,
style: Theme.of(context).textTheme.caption.copyWith(
color: secondaryTextColor,
),
),
],
),
),
],
),
);
}
}
class RatingChip extends StatelessWidget {
const RatingChip({
@required this.rating,
});
final num rating;
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 2),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: ratingBarColor,
),
child: Row(
children: [
const Icon(
Icons.star,
size: 16,
color: ratingStarColor,
),
const SizedBox(width: 4),
Text(
rating.toString(),
style: const TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
),
),
],
),
);
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view | mirrored_repositories/FlutterFoodyBite/lib/view/Widgets/no_restaurant.dart | import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:foodybite/constants/colors.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/constants/icons.dart';
import 'package:foodybite/utils/size_config.dart';
class NoRestaurantTile extends StatelessWidget {
const NoRestaurantTile({
@required this.title,
@required this.subtitle,
});
final String title, subtitle;
@override
Widget build(BuildContext context) {
return Container(
height: getRelativeHeight(0.4),
width: getRelativeWidth(0.9),
padding: const EdgeInsets.all(defaultPadding),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(defaultBorderRadius),
color: Colors.white,
),
child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
SvgPicture.asset(
MIcons.no_food,
height: getRelativeWidth(0.3),
),
const SizedBox(height: defaultPadding),
Text(
title,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.headline6.copyWith(
color: textColor,
),
),
const SizedBox(height: defaultPadding),
Text(
subtitle,
textAlign: TextAlign.center,
style: TextStyle(
color: secondaryTextColor,
),
)
]),
);
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view | mirrored_repositories/FlutterFoodyBite/lib/view/Widgets/round_button.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/colors.dart';
class RoundButton extends StatelessWidget {
const RoundButton({
Key key,
@required this.label,
@required this.onTap,
this.rightRound = true,
this.leftRound = true,
}) : super(key: key);
final String label;
final VoidCallback onTap;
final bool rightRound, leftRound;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onTap,
child: Container(
height: 55,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(leftRound ? 30 : 0),
topRight: Radius.circular(rightRound ? 30 : 0),
),
color: primaryColor,
),
child: Center(
child: Text(
label,
style: Theme.of(context).textTheme.subtitle1.copyWith(
color: Colors.white,
),
),
),
),
);
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view | mirrored_repositories/FlutterFoodyBite/lib/view/Widgets/search_field.dart | import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:foodybite/constants/colors.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/constants/icons.dart';
class SearchField extends StatelessWidget {
const SearchField({
this.onLeadingTap,
@required this.hint,
this.suffixWidget,
@required this.controller,
this.onFieldSubmitted,
});
final String hint;
final VoidCallback onLeadingTap;
final Widget suffixWidget;
final TextEditingController controller;
final Function(String value) onFieldSubmitted;
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.symmetric(
horizontal: defaultPadding,
),
height: 56,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(defaultBorderRadius),
color: Colors.white,
border: Border.all(
color: secondaryTextColor,
width: 0.2,
),
),
child: Row(
children: [
Expanded(
child: TextFormField(
onFieldSubmitted: onFieldSubmitted,
controller: controller,
textAlignVertical: TextAlignVertical.center,
cursorColor: textColor,
style: Theme.of(context)
.textTheme
.subtitle1
.copyWith(color: textColor),
decoration: InputDecoration(
hintText: hint,
hintStyle: Theme.of(context)
.textTheme
.subtitle1
.copyWith(color: secondaryTextColor),
border: InputBorder.none,
prefixIcon: Transform.scale(
scale: 0.34,
child: SvgPicture.asset(
MIcons.search,
color: secondaryTextColor,
height: 30,
),
),
),
),
),
if (onLeadingTap != null)
GestureDetector(
onTap: onLeadingTap,
child: Transform.scale(
scale: 0.55,
child: SvgPicture.asset(
MIcons.filter,
color: secondaryTextColor,
height: 30,
),
),
),
const SizedBox(
width: defaultPadding,
),
],
),
);
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view | mirrored_repositories/FlutterFoodyBite/lib/view/Widgets/category_chip.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/colors.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/models/restaurant_model.dart';
import 'package:get/get.dart';
class CategoryChip extends StatelessWidget {
const CategoryChip({
@required this.category,
Key key,
}) : super(key: key);
final FCategory category;
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 4,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(defaultBorderRadius),
gradient: getCategoryGradient(category),
),
child: Center(
child: Text(
category.toString().split('.').last.tr,
style: Theme.of(context).textTheme.caption.copyWith(
fontSize: 8,
color: Colors.white,
),
),
));
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view | mirrored_repositories/FlutterFoodyBite/lib/view/Widgets/app_title.dart | import 'package:flutter/material.dart';
class AppTitle extends StatelessWidget {
const AppTitle({@required this.color});
final Color color;
@override
Widget build(BuildContext context) {
return Text(
"Foodybite",
style: Theme.of(context).textTheme.headline3.copyWith(
color: color,
letterSpacing: 0.5,
fontWeight: FontWeight.bold,
height: 0.6,
),
);
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view | mirrored_repositories/FlutterFoodyBite/lib/view/Widgets/app_bar.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/colors.dart';
class MAppBar extends StatelessWidget implements PreferredSizeWidget {
const MAppBar({
@required this.title,
@required this.appBar,
this.actions,
this.bgColor,
this.txtColor,
});
final String title;
final AppBar appBar;
final List<Widget> actions;
final Color bgColor, txtColor;
@override
Widget build(BuildContext context) {
return AppBar(
elevation: 0,
backgroundColor: bgColor ?? appBarColor,
centerTitle: true,
title: Text(
title,
style: TextStyle(
color: txtColor ?? Colors.black,
),
),
iconTheme: IconThemeData(
color: txtColor ?? Colors.black,
),
actions: actions ?? [],
);
}
@override
Size get preferredSize => Size.fromHeight(appBar.preferredSize.height);
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib/view | mirrored_repositories/FlutterFoodyBite/lib/view/dialogs/m_dialogs.dart | import 'package:flutter/material.dart';
import 'package:foodybite/constants/colors.dart';
import 'package:foodybite/constants/consts.dart';
import 'package:foodybite/constants/values.dart';
import 'package:get/get.dart';
class MDialogs {
static Future<void> confirmationDialog({
@required String title,
@required VoidCallback onYesTap,
@required VoidCallback onNoTap,
}) {
return Get.defaultDialog(
barrierDismissible: false,
title: title,
titleStyle: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.w600,
height: 1.5,
),
titlePadding: const EdgeInsets.fromLTRB(
defaultPadding * 1.5,
defaultPadding * 2,
defaultPadding * 1.5,
defaultPadding * 2,
),
content: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
GestureDetector(
onTap: onNoTap,
child: Text(
Values.no.tr,
style: const TextStyle(
fontSize: 16,
color: textColor,
fontWeight: FontWeight.w600,
),
),
),
GestureDetector(
onTap: onYesTap,
child: Text(
Values.yes.tr,
style: const TextStyle(
fontSize: 16,
color: primaryColor,
fontWeight: FontWeight.w600,
),
),
),
],
));
}
static Future<void> menuDialog({
@required VoidCallback onEditTap,
@required VoidCallback onDeleteTap,
}) {
return Get.defaultDialog(
barrierDismissible: false,
title: '',
titlePadding: const EdgeInsets.all(0),
content: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
GestureDetector(
onTap: onEditTap,
child: Text(
Values.edit.tr,
style: const TextStyle(
fontSize: 16,
color: textColor,
fontWeight: FontWeight.w600,
),
),
),
const SizedBox(height: defaultPadding * 2),
GestureDetector(
onTap: onDeleteTap,
child: Text(
Values.delete.tr,
style: const TextStyle(
fontSize: 16,
color: textColor,
fontWeight: FontWeight.w600,
),
),
),
const SizedBox(height: defaultPadding * 2),
GestureDetector(
onTap: () {
Get.back();
},
child: Text(
Values.cancel.tr,
style: const TextStyle(
fontSize: 16,
color: textColor,
fontWeight: FontWeight.w600,
),
),
),
],
));
}
static Future<void> imagePickerDialog({
@required VoidCallback onCameraTap,
@required VoidCallback onGalleryTap,
}) {
return Get.defaultDialog(
title: Values.chose_or_take_picture.tr,
titleStyle: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.w600,
height: 1.5,
),
titlePadding: const EdgeInsets.fromLTRB(
defaultPadding * 1.5,
defaultPadding * 2,
defaultPadding * 1.5,
defaultPadding,
),
content: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
GestureDetector(
onTap: onCameraTap,
child: Column(
children: [
const Icon(
Icons.photo_camera_outlined,
size: 36,
color: primaryColor,
),
Text(
Values.camera.tr,
style: TextStyle(
fontSize: 14,
color: secondaryTextColor,
fontWeight: FontWeight.w600,
),
),
],
),
),
GestureDetector(
onTap: onGalleryTap,
child: Column(
children: [
const Icon(
Icons.image,
size: 36,
color: primaryColor,
),
Text(
Values.gallery.tr,
style: TextStyle(
fontSize: 14,
color: secondaryTextColor,
fontWeight: FontWeight.w600,
),
),
],
),
),
],
),
);
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib | mirrored_repositories/FlutterFoodyBite/lib/translations/translation.dart | import 'package:get/get.dart';
class Translation extends Translations {
@override
Map<String, Map<String, String>> get keys => {
'en_US': _en,
'zh_CN': _zh,
'es_ES': _es,
'ar_SA': _ar,
};
Map<String, String> _zh = {
"are_you_sure_change_language": "您确定要更改应用程序的语言吗?",
"arabic": "阿拉伯语",
"spanish": "西班牙语",
"english": "英语",
"mexican": "墨西哥菜",
"arabian": "阿拉伯的",
"korean": "韩语",
"indian": "印度人",
"thai": "泰语",
"american": "美国人",
"chinese": "中文",
"italian": "意大利语",
"review": "回顾",
"categories": "类别",
"skip": "跳过",
"email": "电子邮件",
"password": "密码",
"forgot_password": "忘记密码",
"login": "登录",
"create_new_account": "创建新帐户",
"send": "发送",
"enter_email_for_forgot_password": "输入您的电子邮件,并将向您发送有关如何设置的说明",
"name": "姓名",
"confirm_password": "确认密码",
"register": "注册",
"already_have_account": "已经有账户?",
"hi": "嗨",
"welcome_to": "欢迎来到",
"please_turn_on_gps": "请打开您的 GPS 以查找您附近更好的餐厅建议。",
"turn_on_gps": "打开 GPS",
"find_restaurants": "寻找餐厅",
"trending_restaurants": "热门餐厅",
"see_all": "查看全部",
"open": "打开",
"close": "关闭",
"category": "类别",
"friends": "朋友",
"filter": "过滤器",
"select_category": "选择类别",
"distance": "距离",
"ratings": "评分",
"reset": "重置",
"apply": "申请",
"search": "搜索",
"open_now": "立即开放",
"close_now": "现已关闭",
"daily_time": "每日时间",
"menu_n_photos": "菜单和照片",
"review_n_ratings": "评论和评分",
"rate_your_experience": "评价您的体验",
"direction": "方向",
"preview": "预览",
"write_your_experience": "写下你的经历",
"done": "完成",
"find_friends": "找朋友",
"suggestions": "建议",
"follow": "关注",
"followers": "追随者",
"following": "关注",
"unfollow": "取消关注",
"profile": "简介",
"my_profile": "我的简介",
"reviews": "评论",
"block": "块",
"post": "发布",
"new_review": "新评论",
"edit_review": "编辑评论",
"search_restaurants": "搜索餐厅",
"my_favourite": "我的最爱",
"notifications": "通知",
"settings": "设置",
"account": "帐户",
"change_password": "更改密码",
"change_language": "更改语言",
"others": "其他",
"privacy_policy": "隐私政策",
"terms_n_conditions": "条款和条件",
"logout": "登出",
"current_password": "当前密码",
"new_password": "新密码",
"select_language": "选择语言",
"update": "更新",
"yes": "是的",
"no": "否",
"are_you_sure_logout": "您确定要退出吗?",
"edit_profile": "编辑个人资料",
"edit": "编辑",
"cancel": "取消",
"delete": "删除",
"are_you_sure_delete_post": "您确定要删除此帖子吗?",
"chose_or_take_picture": "选择或拍摄自己的最佳照片。",
"camera": "相机",
"gallery": "画廊"
};
Map<String, String> _es = {
"are_you_sure_change_language":
"¿Estás seguro de que deseas cambiar el idioma de la aplicación?",
"araibc": "Arábica",
"spanish": "Español",
"english": "Inglés",
"mexican": "Mexicano",
"arabian": "árabe",
"korean": "Coreano",
"thai": "Tailandés",
"american": "Americano",
"chinese": "Chino",
"italian": "Italiano",
"review": "Revisar",
"categories": "Categorías",
"skip": "Saltar",
"email": "Correo electrónico",
"password": "Contraseña",
"forgot_password": "Has olvidado tu contraseña",
"login": "Acceso",
"create_new_account": "Crear una nueva cuenta",
"send": "Enviar",
"enter_email_for_forgot_password":
// ignore: lines_longer_than_80_chars
"Ingrese su correo electrónico y le enviaremos instrucciones sobre cómo configurarlo",
"name": "Nombre",
"confirm_password": "confirmar Contraseña",
"register": "Registrarse",
"already_have_account": "¿Ya tienes una cuenta?",
"hi": "Hola",
"welcome_to": "Bienvenido a",
"please_turn_on_gps":
// ignore: lines_longer_than_80_chars
"Encienda su GPS para encontrar mejores sugerencias de restaurantes cerca de usted.",
"turn_on_gps": "Enciende el GPS",
"find_restaurants": "Buscar restaurantes",
"trending_restaurants": "Restaurantes de moda",
"see_all": "Ver todo",
"open": "ABIERTO",
"close": "CERRAR",
"category": "Categoría",
"friends": "Amigos",
"filter": "Filtrar",
"select_category": "selecciona una categoría",
"distance": "Distancia",
"ratings": "Calificaciones",
"reset": "Reiniciar",
"apply": "Solicitar",
"search": "Buscar",
"open_now": "Abierto ahora",
"close_now": "Cerrado ahora",
"daily_time": "tiempo diario",
"menu_n_photos": "Menú y fotos",
"review_n_ratings": "Revisión y calificaciones",
"rate_your_experience": "Califica tu experiencia",
"direction": "Dirección",
"preview": "Avance",
"write_your_experience": "Escribe tu experiencia",
"done": "Hecho",
"find_friends": "Encontrar amigos",
"suggestions": "Sugerencias",
"follow": "Seguir",
"followers": "Seguidores",
"following": "Siguiente",
"unfollow": "Dejar de seguir",
"profile": "Perfil",
"my_profile": "Mi perfil",
"reviews": "Reseñas",
"block": "Cuadra",
"post": "Correo",
"new_review": "Nueva revisión",
"edit_review": "Editar reseña",
"search_restaurants": "Buscar restaurantes",
"my_favourite": "Mi favorito",
"notifications": "Notificaciones",
"settings": "Ajustes",
"account": "Cuenta",
"change_password": "Cambiar la contraseña",
"change_language": "Cambiar idioma",
"others": "Otros",
"privacy_policy": "Política de privacidad",
"terms_n_conditions": "Términos y condiciones",
"logout": "Cerrar sesión",
"current_password": "Contraseña actual",
"new_password": "Nueva contraseña",
"select_language": "Seleccione el idioma",
"update": "Actualizar",
"yes": "sí",
"no": "No",
"are_you_sure_logout": "¿Estás seguro de que quieres cerrar sesión?",
"edit_profile": "Editar perfil",
"edit": "Editar",
"cancel": "Cancelar",
"delete": "Borrar",
"are_you_sure_delete_post":
"¿Estás seguro de que deseas eliminar esta publicación?",
"chose_or_take_picture": "Elija o tome la mejor foto de usted mismo.",
"camera": "Cámara",
"gallery": "Galería",
"indian": "Indio"
};
Map<String, String> _ar = {
"are_you_sure_change_language": "هل أنت متأكد أنك تريد تغيير لغة التطبيق؟",
"arabic": "عربي",
"spanish": "الأسبانية",
"english": "إنجليزي",
"mexican": "مكسيكي",
"arabian": "عربي",
"korean": "الكورية",
"thai": "التايلاندية",
"indian": "هندي",
"american": "أمريكي",
"chinese": "صينى",
"italian": "إيطالي",
"review": "إعادة النظر",
"categories": "فئات",
"skip": "يتخطى",
"email": "بريد الالكتروني",
"password": "كلمه السر",
"forgot_password": "هل نسيت كلمة السر",
"login": "تسجيل الدخول",
"create_new_account": "انشاء حساب جديد",
"send": "يرسل",
"enter_email_for_forgot_password":
"أدخل بريدك الإلكتروني وسوف نرسل لك تعليمات حول كيفية تعيينه",
"name": "اسم",
"confirm_password": "تأكيد كلمة المرور",
"register": "يسجل",
"already_have_account": "هل لديك حساب؟",
"hi": "أهلا",
"welcome_to": "مرحبا بك في",
"please_turn_on_gps":
// ignore: lines_longer_than_80_chars
"يرجى تشغيل نظام تحديد المواقع العالمي (GPS) الخاص بك لاكتشاف اقتراحات أفضل للمطاعم القريبة منك.",
"turn_on_gps": "قم بتشغيل GPS",
"find_restaurants": "البحث عن مطاعم",
"trending_restaurants": "تتجه المطاعم",
"see_all": "اظهار الكل",
"open": "افتح",
"close": "أغلق",
"category": "فئة",
"friends": "اصحاب",
"filter": "منقي",
"select_category": "اختر الفئة",
"distance": "مسافة",
"ratings": "التقييمات",
"reset": "إعادة ضبط",
"apply": "تطبيق",
"search": "بحث",
"open_now": "مفتوح الان",
"close_now": "مغلق الآن",
"daily_time": "الوقت اليومي",
"menu_n_photos": "القائمة والصور",
"review_n_ratings": "مراجعة والتقييمات",
"rate_your_experience": "قيم تجربتك",
"direction": "اتجاه",
"preview": "معاينة",
"write_your_experience": "اكتب تجربتك",
"done": "منتهي",
"find_friends": "البحث عن أصدقاء",
"suggestions": "اقتراحات",
"follow": "يتبع",
"followers": "متابعون",
"following": "التالية",
"unfollow": "الغاء المتابعة",
"profile": "الملف الشخصي",
"my_profile": "ملفي",
"reviews": "المراجعات",
"block": "حاجز",
"post": "بريد",
"new_review": "مراجعة جديدة",
"edit_review": "تحرير المراجعة",
"search_restaurants": "ابحث عن المطاعم",
"my_favourite": "المفضل لدي",
"notifications": "إشعارات",
"settings": "إعدادات",
"account": "حساب",
"change_password": "تغيير كلمة المرور",
"change_language": "تغيير اللغة",
"others": "آحرون",
"privacy_policy": "سياسة خاصة",
"terms_n_conditions": "البنود و الظروف",
"logout": "تسجيل خروج",
"current_password": "كلمة المرور الحالي",
"new_password": "كلمة مرور جديدة",
"select_language": "اختار اللغة",
"update": "تحديث",
"yes": "نعم",
"no": "لا",
"are_you_sure_logout": "هل أنت متأكد أنك تريد تسجيل الخروج؟",
"edit_profile": "تعديل الملف الشخصي",
"edit": "يحرر",
"cancel": "يلغي",
"delete": "حذف",
"are_you_sure_delete_post": "هل أنت متأكد أنك تريد حذف هذه المشاركة؟",
"chose_or_take_picture": "اختر أو التقط أفضل صورة لنفسك.",
"camera": "الة تصوير",
"gallery": "صالة عرض"
};
Map<String, String> _en = {
"are_you_sure_change_language":
"Are you sure you want to change the app's language?",
"arabic": "Arabic",
"spanish": "Spanish",
"english": "English",
"mexican": "Mexican",
"arabian": "Arabian",
"korean": "Korean",
"thai": "Thai",
"indian": "Indian",
"american": "American",
"chinese": "Chinese",
"italian": "Italian",
"review": "Review",
"categories": "Categories",
"skip": "Skip",
"email": "Email",
"password": "Password",
"forgot_password": "Forgot Password",
"login": "Login",
"create_new_account": "Create New Account",
"send": "Send",
"enter_email_for_forgot_password":
"Enter your email and will send you instructions on how to set it",
"name": "Name",
"confirm_password": "Confirm Password",
"register": "Register",
"already_have_account": "Already have an account?",
"hi": "Hi",
"welcome_to": "Welcome to",
"please_turn_on_gps":
// ignore: lines_longer_than_80_chars
"Please turn on your GPS to find out better restaurant suggestions near you.",
"turn_on_gps": "Turn on GPS",
"find_restaurants": "Find Restaurants",
"trending_restaurants": "Trending Restaurants",
"see_all": "See all",
"open": "OPEN",
"close": "CLOSE",
"category": "Category",
"friends": "Friends",
"filter": "Filter",
"select_category": "Select Category",
"distance": "Distance",
"ratings": "Ratings",
"reset": "Reset",
"apply": "Apply",
"search": "Search",
"open_now": "Open now",
"close_now": "Closed now",
"daily_time": "daily time",
"menu_n_photos": "Menu & Photos",
"review_n_ratings": "Review & Ratings",
"rate_your_experience": "Rate Your Experience",
"direction": "Direction",
"preview": "Preview",
"write_your_experience": "Write your experience",
"done": "Done",
"find_friends": "Find Friends",
"suggestions": "Suggestions",
"follow": "Follow",
"followers": "Followers",
"following": "Following",
"unfollow": "Unfollow",
"profile": "Profile",
"my_profile": "My Profile",
"reviews": "Reviews",
"block": "Block",
"post": "Post",
"new_review": "New Review",
"edit_review": "Edit Review",
"search_restaurants": "Search Restaurants",
"my_favourite": "My Favourite",
"notifications": "Notifications",
"settings": "Settings",
"account": "Account",
"change_password": "Change Password",
"change_language": "Change Language",
"others": "Others",
"privacy_policy": "Privacy Policy",
"terms_n_conditions": "Terms & Conditions",
"logout": "Logout",
"current_password": "Current Password",
"new_password": "New Password",
"select_language": "Select Language",
"update": "Update",
"yes": "Yes",
"no": "No",
"are_you_sure_logout": "Are you sure you want to logout?",
"edit_profile": "Edit Profile",
"edit": "Edit",
"cancel": "Cancel",
"delete": "Delete",
"are_you_sure_delete_post": "Are you sure you want to delete this post?",
"chose_or_take_picture": "Choose or take the best picture of yourself.",
"camera": "Camera",
"gallery": "Gallery"
};
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib | mirrored_repositories/FlutterFoodyBite/lib/Utils/validators.dart | import 'package:get/get.dart';
class Validators {
static String passwordValidator(String value) {
if (value.isEmpty || value == null) {
return "Required";
} else if (value.length < 8) {
return "Password too short";
} else {
return null;
}
}
static String confirmPasswordValidator(
String password, String confirmPassword) {
if (confirmPassword.isEmpty || confirmPassword == null) {
return "Required";
} else if (confirmPassword.length < 8) {
return "Password too short";
} else if (confirmPassword != password) {
return "Password do not match";
} else {
return null;
}
}
static String usernameValidator(String value) {
if (value.isEmpty || value == null) {
return "Required";
} else if (!GetUtils.isUsername(value)) {
return "Invalid Username";
} else {
return null;
}
}
static String emailValidator(String value) {
if (value.isEmpty || value == null) {
return "Required";
} else if (!GetUtils.isEmail(value)) {
return "Invalid Email";
} else {
return null;
}
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib | mirrored_repositories/FlutterFoodyBite/lib/Utils/datetime_utils.dart | import 'package:intl/intl.dart';
class DateTimeUtils {
static String dateToString(DateTime date) {
final diff = calculateDateDifference(date);
switch (diff) {
case 0:
return DateFormat.Hm().format(date);
case -1:
return 'Yesterday';
default:
return DateFormat.yMMMd().format(date);
}
// if (diff == -1) return "Yesterday";
// if (diff == 0) return "Today";
// if (diff == 1) {
// return "Tomorrow";
// } else {
// return DateFormat.EEEE().format(date);
// }
}
static int calculateDateDifference(DateTime date) {
final now = DateTime.now();
return DateTime(date.year, date.month, date.day)
.difference(DateTime(now.year, now.month, now.day))
.inDays;
}
static int calculateAverage(List<int> nums) {
final avg = nums.reduce((num a, num b) => a + b) / nums.length;
return avg.toInt();
}
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib | mirrored_repositories/FlutterFoodyBite/lib/Utils/size_config.dart | import 'package:flutter/material.dart';
class SizeConfig {
static double screenWidth;
static double screenHeight;
static void initSize(BuildContext context) {
final mediaQuery = MediaQuery.of(context);
screenWidth = mediaQuery.size.width;
screenHeight = mediaQuery.size.height;
}
}
double getRelativeHeight(double percentage) {
return percentage * SizeConfig.screenHeight;
}
double getRelativeWidth(double percentage) {
return percentage * SizeConfig.screenWidth;
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib | mirrored_repositories/FlutterFoodyBite/lib/models/review_model.dart | import 'package:flutter/cupertino.dart';
class Review {
Review({
@required this.rating,
@required this.userImgPath,
@required this.userName,
@required this.review,
@required this.restaurantName,
@required this.restaurantImgPath,
});
final String userName, userImgPath, review, restaurantName, restaurantImgPath;
final int rating;
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib | mirrored_repositories/FlutterFoodyBite/lib/models/notification_model.dart | import 'package:flutter/foundation.dart';
class NotificationModel {
NotificationModel({
@required this.iconPath,
@required this.source,
@required this.description,
@required this.dateTime,
});
final String iconPath, source, description;
final DateTime dateTime;
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib | mirrored_repositories/FlutterFoodyBite/lib/models/data.dart | import 'package:foodybite/constants/images.dart';
import 'package:foodybite/models/notification_model.dart';
import 'package:foodybite/models/restaurant_model.dart';
import 'package:foodybite/models/review_model.dart';
import 'package:foodybite/models/user_model.dart';
String r = 'It is a long established fact that a reader will be distracted'
' by the readable content of a page when looking at its layout. '
'The point of using Lorem Ipsum is that it has a more-or-less normal '
'distribution of letters';
List<Restaurant> restaurantList = [
Restaurant(
displayFoodImg: Images.f1,
name: 'Happy Bones',
totalRating: 4.5,
address: '394 Broome St, New York, NY 10013, USA',
isOpen: true,
category: FCategory.italian,
reviews: reviewList,
foodImages: foodsImgList,
),
Restaurant(
reviews: reviewList,
foodImages: foodsImgList,
displayFoodImg: Images.f2,
name: 'Uncle Boons',
totalRating: 4.3,
address: '7 Spring St, New York, NY 10012, USA',
isOpen: true,
category: FCategory.chinese,
),
Restaurant(
reviews: reviewList,
foodImages: foodsImgList,
displayFoodImg: Images.f3,
name: 'Uncle Boons',
totalRating: 4.2,
address: '7 Spring St, New York, NY 10012, USA',
isOpen: false,
category: FCategory.chinese,
),
Restaurant(
displayFoodImg: Images.f4,
name: 'Cafe de',
totalRating: 4.5,
address: '394 Broome St, New York, NY 10013, USA',
isOpen: true,
category: FCategory.mexican,
reviews: reviewList,
foodImages: foodsImgList,
),
Restaurant(
reviews: reviewList,
foodImages: foodsImgList,
displayFoodImg: Images.f5,
name: 'Desi Khana',
totalRating: 4.3,
address: '7 Spring St, New York, NY 10012, USA',
isOpen: true,
category: FCategory.indian,
),
Restaurant(
reviews: reviewList,
foodImages: foodsImgList,
displayFoodImg: Images.f6,
name: 'Uncle Boons',
totalRating: 4.2,
address: '7 Spring St, New York, NY 10012, USA',
isOpen: false,
category: FCategory.italian,
),
Restaurant(
displayFoodImg: Images.f7,
name: 'Happy Bones',
totalRating: 4.5,
address: '394 Broome St, New York, NY 10013, USA',
isOpen: true,
category: FCategory.american,
reviews: reviewList,
foodImages: foodsImgList,
),
Restaurant(
reviews: reviewList,
foodImages: foodsImgList,
displayFoodImg: Images.f8,
name: 'Uncle Boons',
totalRating: 4.3,
address: '7 Spring St, New York, NY 10012, USA',
isOpen: true,
category: FCategory.arabian,
),
Restaurant(
reviews: reviewList,
foodImages: foodsImgList,
displayFoodImg: Images.f9,
name: 'Uncle Boons',
totalRating: 4.2,
address: '7 Spring St, New York, NY 10012, USA',
isOpen: false,
category: FCategory.korean,
),
];
List<Review> reviewList = [
Review(
rating: 4,
userImgPath: Images.d1,
userName: 'Patty Howard',
review: r.substring(1, 80),
restaurantImgPath: Images.f1,
restaurantName: 'Happy Bones',
),
Review(
rating: 5,
userImgPath: Images.d2,
userName: 'Antonio Banks',
review: r.substring(1, 120),
restaurantImgPath: Images.f2,
restaurantName: 'Uncle Boons',
),
Review(
rating: 4,
userImgPath: Images.d3,
userName: 'Franklin Cox',
review: r.substring(1, 200),
restaurantImgPath: Images.f3,
restaurantName: 'Cheesy Does It',
),
Review(
rating: 4,
userImgPath: Images.d4,
userName: 'Kristopher Ward',
review: r.substring(1, 120),
restaurantImgPath: Images.f4,
restaurantName: 'Work N\' Roll',
),
Review(
rating: 4,
userImgPath: Images.d5,
userName: 'Christopher Jennings',
review: r.substring(1, 60),
restaurantImgPath: Images.f5,
restaurantName: 'Wild Theme Cafe',
),
Review(
rating: 4,
userImgPath: Images.d6,
userName: 'Roy Kim',
review: r.substring(1, 90),
restaurantImgPath: Images.f6,
restaurantName: 'Work This Way',
),
Review(
rating: 4,
userImgPath: Images.d7,
userName: 'Drew Willis',
review: r.substring(1, 111),
restaurantImgPath: Images.f7,
restaurantName: '16 Handle',
),
Review(
rating: 4,
userImgPath: Images.d8,
userName: 'Claude Torres',
review: r.substring(1, 123),
restaurantImgPath: Images.f8,
restaurantName: 'Le Bernardin',
),
Review(
rating: 4,
userImgPath: Images.d9,
userName: 'Angelo Jordan',
review: r.substring(1, 99),
restaurantImgPath: Images.f9,
restaurantName: 'Healthy Wealthy',
),
Review(
rating: 4,
userImgPath: Images.d10,
userName: 'Cory Barber',
review: r.substring(1, 166),
restaurantImgPath: Images.f10,
restaurantName: 'Green\'O Zoone',
),
];
List<String> foodsImgList = [
Images.f1,
Images.f2,
Images.f3,
Images.f4,
Images.f5,
Images.f6,
Images.f7,
Images.f8,
Images.f9,
Images.f10,
Images.f11,
Images.f12,
Images.f13,
Images.f14,
];
List<UserModel> userList = [
UserModel(
reviews: reviewList,
name: 'Patty Howard',
imgPath: Images.d1,
),
UserModel(
reviews: reviewList,
name: 'Antonio Banks',
imgPath: Images.d2,
),
UserModel(
reviews: reviewList,
name: 'Franklin Cox',
imgPath: Images.d3,
),
UserModel(
reviews: reviewList,
name: 'Kristopher Ward',
imgPath: Images.d4,
),
UserModel(
reviews: reviewList,
name: 'Christopher Jennings',
imgPath: Images.d5,
),
UserModel(
reviews: reviewList,
name: 'Roy Kim',
imgPath: Images.d6,
),
UserModel(
reviews: reviewList,
name: 'Drew Willis',
imgPath: Images.d7,
),
UserModel(
reviews: reviewList,
name: 'Claude Torres',
imgPath: Images.d8,
),
UserModel(
reviews: reviewList,
name: 'Angelo Jordan',
imgPath: Images.d9,
),
];
List<NotificationModel> notificationList = [
NotificationModel(
iconPath: Images.d1,
source: 'Branson Hawkins',
description: 'Start following you',
dateTime: DateTime.utc(2021, 08, 22, 10, 30),
),
NotificationModel(
iconPath: Images.d3,
source: 'Julia Lari',
description: 'Checked in at Happy Bones',
dateTime: DateTime.utc(2021, 08, 22, 05, 30),
),
NotificationModel(
iconPath: Images.d1,
source: 'Random Person',
description: 'Checked in at Uncle Bones',
dateTime: DateTime.utc(2021, 08, 21, 05, 30),
),
NotificationModel(
iconPath: Images.d1,
source: 'Branson Hawkins',
description: 'Start following you',
dateTime: DateTime.utc(2021, 08, 20, 05, 30),
),
NotificationModel(
iconPath: Images.d3,
source: 'Julia Lari',
description: 'Checked in at Happy Bones',
dateTime: DateTime.utc(2021, 08, 19, 05, 30),
),
NotificationModel(
iconPath: Images.d1,
source: 'Random Person',
description: 'Checked in at Uncle Bones',
dateTime: DateTime.utc(2021, 08, 18, 05, 30),
)
];
| 0 |
mirrored_repositories/FlutterFoodyBite/lib | mirrored_repositories/FlutterFoodyBite/lib/models/restaurant_model.dart | import 'package:flutter/cupertino.dart';
import 'package:foodybite/models/review_model.dart';
enum FCategory {
italian,
chinese,
american,
indian,
thai,
korean,
arabian,
mexican,
}
class Restaurant {
Restaurant({
@required this.address,
@required this.category,
@required this.displayFoodImg,
@required this.isOpen,
@required this.name,
@required this.totalRating,
@required this.reviews,
@required this.foodImages,
});
String name, address, displayFoodImg;
FCategory category;
double totalRating;
List<Review> reviews;
bool isOpen;
List<String> foodImages;
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib | mirrored_repositories/FlutterFoodyBite/lib/models/user_model.dart | import 'package:flutter/foundation.dart';
import 'package:foodybite/models/review_model.dart';
class UserModel {
UserModel(
{@required this.reviews, @required this.name, @required this.imgPath});
String name, imgPath;
List<Review> reviews;
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib | mirrored_repositories/FlutterFoodyBite/lib/services/local_db_service.dart | import 'package:get_storage/get_storage.dart';
class LocalDBService {
final _box = GetStorage();
final _language = 'language';
String getLanguage() => _box.read(_language);
void saveLanguage(String language) => _box.write(_language, language);
}
| 0 |
mirrored_repositories/FlutterFoodyBite/lib | mirrored_repositories/FlutterFoodyBite/lib/services/system_service.dart | import 'package:image_picker/image_picker.dart';
class SystemService {
final picker = ImagePicker();
Future<XFile> imageFromCamera() async {
return await picker.pickImage(source: ImageSource.camera);
}
Future<XFile> imageFromGallery() async {
return await picker.pickImage(source: ImageSource.gallery);
}
}
| 0 |
mirrored_repositories/daily-task-flutter | mirrored_repositories/daily-task-flutter/lib/main.dart | import 'package:example_provider/models/task_data.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'screens/tasks_screen.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ChangeNotifierProvider(
create: (context) => TaskData(),
child: MaterialApp(
debugShowCheckedModeBanner: false,
home: TaskSrc(),
),
);
}
}
| 0 |
mirrored_repositories/daily-task-flutter/lib | mirrored_repositories/daily-task-flutter/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
: TextDecoration.none),
),
trailing: Checkbox(
activeColor: Colors.lightBlueAccent,
value: isChecked,
onChanged: checkboxCallback,
),
);
}
}
| 0 |
mirrored_repositories/daily-task-flutter/lib | mirrored_repositories/daily-task-flutter/lib/widgets/task_list.dart | import 'package:example_provider/widgets/task_tile.dart';
import 'package:example_provider/models/task_data.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.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 Padding(
padding: const EdgeInsets.only(bottom: 10.0),
child: TaskTile(
taskTitle: task.name,
isChecked: task.isDone,
checkboxCallback: (checkedboxState) {
taskData.updateTask(task);
},
longPressCallback: () {
taskData.deleteTask(task);
},
),
);
},
itemCount: taskData.taskCount,
);
},
);
}
}
| 0 |
mirrored_repositories/daily-task-flutter/lib | mirrored_repositories/daily-task-flutter/lib/models/task.dart | class Task {
final String name;
bool isDone;
Task({this.name, this.isDone = false});
void toggleDone() {
isDone = !isDone;
}
}
| 0 |
mirrored_repositories/daily-task-flutter/lib | mirrored_repositories/daily-task-flutter/lib/models/task_data.dart | import 'package:example_provider/models/task.dart';
import 'package:flutter/foundation.dart';
import 'dart:collection';
class TaskData extends ChangeNotifier {
List<Task> _tasks = [];
UnmodifiableListView<Task> get tasks {
return UnmodifiableListView(_tasks);
}
int get taskCount {
return _tasks.length;
}
void addTask(String newTaskTitle) {
final task = Task(name: newTaskTitle);
_tasks.add(task);
notifyListeners();
}
void updateTask(Task task) {
task.toggleDone();
notifyListeners();
}
void deleteTask(Task task) {
_tasks.remove(task);
notifyListeners();
}
}
| 0 |
mirrored_repositories/daily-task-flutter/lib | mirrored_repositories/daily-task-flutter/lib/screens/add_task_screen.dart | import 'package:example_provider/models/task_data.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class AddTaskScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
String newTaskTitle;
return Container(
color: Color(0xff757575),
child: Container(
padding: EdgeInsets.all(20.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20),
topRight: Radius.circular(20),
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(top: 20),
child: Text(
'Add Task',
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.lightBlueAccent,
fontSize: 30,
fontWeight: FontWeight.w700,
),
),
),
SizedBox(
height: 15,
),
TextField(
autofocus: true,
textAlign: TextAlign.center,
onChanged: (value) {
newTaskTitle = value;
},
),
SizedBox(
height: 15,
),
FlatButton(
child: Text(
'Button',
style: TextStyle(
color: Colors.white,
),
),
color: Colors.lightBlueAccent,
padding: EdgeInsets.only(
right: 20, left: 20, top: 15, bottom: 15),
onPressed: () {
Provider.of<TaskData>(context, listen: false)
.addTask(newTaskTitle);
Navigator.pop(context);
},
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/daily-task-flutter/lib | mirrored_repositories/daily-task-flutter/lib/screens/tasks_screen.dart | import 'package:example_provider/models/task_data.dart';
import 'package:example_provider/screens/add_task_screen.dart';
import 'package:example_provider/widgets/task_list.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class TaskSrc extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.lightBlueAccent,
floatingActionButton: FloatingActionButton(
backgroundColor: Colors.lightBlueAccent,
child: Icon(Icons.add),
onPressed: () {
showModalBottomSheet(
isScrollControlled: true,
context: context,
builder: (context) => AddTaskScreen(),
);
},
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
padding: EdgeInsets.only(
top: 60, left: 30, right: 30, bottom: 30),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
CircleAvatar(
child: Icon(
Icons.list,
size: 30,
color: Colors.lightBlueAccent,
),
backgroundColor: Colors.white,
radius: 30,
),
SizedBox(height: 10.0),
Text(
'Daily Task',
style: TextStyle(
color: Colors.white,
fontSize: 50,
fontWeight: FontWeight.w700,
),
),
Text(
'${Provider.of<TaskData>(context).taskCount} Task',
style: TextStyle(
color: Colors.white,
fontSize: 18,
),
),
],
),
),
Expanded(
child: Container(
padding: EdgeInsets.symmetric(horizontal: 20),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20),
topRight: Radius.circular(20),
),
),
child: TaskList(),
),
),
],
),
);
}
}
| 0 |
mirrored_repositories/daily-task-flutter | mirrored_repositories/daily-task-flutter/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:example_provider/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/MySoftballTeam | mirrored_repositories/MySoftballTeam/lib/globals.dart | library my_softball_team.globals;
import 'package:flutter/material.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
FirebaseUser loggedInUser;
String teamName;
String selectedPlayerName;
String selectedGameDocument;
CollectionReference usersDB = Firestore.instance.collection("Users");
CollectionReference gamesDB = Firestore.instance.collection("Teams").document(teamName).collection("Seasons").document(DateTime.now().year.toString()).collection("Games");
CollectionReference teamPlayersDB = Firestore.instance.collection("Teams").document(teamName).collection("Players");
// List of field positions
List<DropdownMenuItem> fieldPositions = [
DropdownMenuItem(
child: Text("Pitcher"),
value: "Pitcher",
),
DropdownMenuItem(
child: Text("First Base"),
value: "First Base",
),
DropdownMenuItem(
child: Text("Second Base"),
value: "Second Base",
),
DropdownMenuItem(
child: Text("Shortstop"),
value: "Shortstop",
),
DropdownMenuItem(
child: Text("Third Base"),
value: "Third Base",
),
DropdownMenuItem(
child: Text("Right Field"),
value: "Right Field",
),
DropdownMenuItem(
child: Text("Right Center Field"),
value: "Right Center Field",
),
DropdownMenuItem(
child: Text("Center Field"),
value: "Center Field",
),
DropdownMenuItem(
child: Text("Left Center Field"),
value: "Left Center Field",
),
DropdownMenuItem(
child: Text("Left Field"),
value: "Left Field",
),
DropdownMenuItem(
child: Text("Catcher"),
value: "Catcher",
),
];
// This function converts String dates and times into
// formatted DateTime and TimeOfDay objects
DateTime convertStringDateToDateTime(String date, String time) {
List<String> splittedDateString = date.split(' ');
List<String> splittedTimeString = time.split('');
DateTime resultDate;
String toParseAsDate;
String year = splittedDateString[2];
String month;
String day;
String timeDenotion = "T";
String hour;
String minute;
switch(splittedDateString[0]){
case "January":
month = "01";
break;
case "February":
month = "02";
break;
case "March":
month = "03";
break;
case "April":
month = "04";
break;
case "May":
month = "05";
break;
case "June":
month = "06";
break;
case "July":
month = "07";
break;
case "August":
month = "08";
break;
case "September":
month = "09";
break;
case "October":
month = "10";
break;
case "November":
month = "11";
break;
case "December":
month = "12";
break;
}
switch(splittedDateString[1]){
case "1,":
day = "01";
break;
case "2,":
day = "02";
break;
case "3,":
day = "03";
break;
case "4,":
day = "04";
break;
case "5,":
day = "05";
break;
case "6,":
day = "06";
break;
case "7,":
day = "07";
break;
case "8,":
day = "08";
break;
case "9,":
day = "09";
break;
case "10,":
day = "10";
break;
case "11,":
day = "11";
break;
case "12,":
day = "12";
break;
case "13,":
day = "13";
break;
case "14,":
day = "14";
break;
case "15,":
day = "15";
break;
case "16,":
day = "16";
break;
case "17,":
day = "17";
break;
case "18,":
day = "18";
break;
case "19,":
day = "19";
break;
case "20,":
day = "20";
break;
case "21,":
day = "21";
break;
case "22,":
day = "22";
break;
case "23,":
day = "23";
break;
case "24,":
day = "24";
break;
case "25,":
day = "25";
break;
case "26,":
day = "26";
break;
case "27,":
day = "27";
break;
case "28,":
day = "28";
break;
case "29,":
day = "29";
break;
case "30,":
day = "30";
break;
case "31,":
day = "31";
break;
}
if(splittedTimeString[5] == "A") {
switch(splittedTimeString[0]){
case '1':
hour = "01";
break;
case '2':
hour = "02";
break;
case '3':
hour = "03";
break;
case '4':
hour = "04";
break;
case '5':
hour = "05";
break;
case '6':
hour = "06";
break;
case '7':
hour = "07";
break;
case '8':
hour = "08";
break;
case '9':
hour = "09";
break;
case '10':
hour = "10";
break;
case '11':
hour = "11";
break;
case '12':
hour = "12";
break;
}
} else {
switch(splittedTimeString[0]){
case '1':
hour = "13";
break;
case '2':
hour = "14";
break;
case '3':
hour = "15";
break;
case '4':
hour = "16";
break;
case '5':
hour = "17";
break;
case '6':
hour = "18";
break;
case '7':
hour = "19";
break;
case '8':
hour = "20";
break;
case '9':
hour = "21";
break;
case '10':
hour = "22";
break;
case '11':
hour = "23";
break;
case '12':
hour = "24";
break;
}
}
minute = splittedTimeString[2] + splittedTimeString[3];
/*if(splittedTimeString[2].length < 2) {
switch(splittedTimeString[2]){
case "0":
minute = "00";
break;
case "1":
minute = "01";
break;
case "2":
minute = "02";
break;
case "3":
minute = "03";
break;
case "4":
minute = "04";
break;
case "5":
minute = "05";
break;
case "6":
minute = "06";
break;
case "7":
minute = "08";
break;
case "8":
minute = "08";
break;
case "9":
minute = "09";
break;
}
} else {
minute = splittedTimeString[2];
}*/
toParseAsDate = year + month + day + "T" + hour + minute;
//toParseAsDate = "$year$month$day$timeDenotion$hour$minute";
resultDate = DateTime.parse(toParseAsDate);
return resultDate;
} | 0 |
mirrored_repositories/MySoftballTeam | mirrored_repositories/MySoftballTeam/lib/check_login.dart | import 'package:flutter/material.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:my_softball_team/screens/home_screen.dart';
import 'package:my_softball_team/globals.dart' as globals;
import 'package:my_softball_team/screens/login.dart';
import 'package:shared_preferences/shared_preferences.dart';
class CheckLogin extends StatefulWidget {
@override
_CheckLoginState createState() => _CheckLoginState();
}
class _CheckLoginState extends State<CheckLogin> {
void _checkLoginState() async {
FirebaseUser user = await FirebaseAuth.instance.currentUser();
if(user != null){
globals.loggedInUser = user;
SharedPreferences prefs = await SharedPreferences.getInstance();
String teamName = prefs.getString("Team");
if(teamName != null || teamName != "")
globals.teamName = teamName;
Navigator.pushReplacement(context, MaterialPageRoute(builder: (BuildContext context) => HomeScreen()));
} else {
try {
Navigator.pushReplacement(context, MaterialPageRoute(builder: (BuildContext context) => LoginPage()));
} catch (e) {
print(e);
}
}
}
@override
void initState() {
super.initState();
_checkLoginState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Center(child: CircularProgressIndicator()));
}
} | 0 |
mirrored_repositories/MySoftballTeam | mirrored_repositories/MySoftballTeam/lib/main.dart | import 'package:flutter/material.dart';
import 'package:my_softball_team/check_login.dart';
import 'package:my_softball_team/screens/SeasonSchedule/add_new_game.dart';
import 'package:my_softball_team/screens/Player/add_new_player.dart';
import 'package:my_softball_team/screens/EmailList/email_list.dart';
import 'package:my_softball_team/screens/signup.dart';
import 'package:my_softball_team/screens/previous_games_list.dart';
import 'package:my_softball_team/screens/SeasonSchedule/season_schedule.dart';
import 'package:my_softball_team/screens/home_screen.dart';
import 'package:my_softball_team/screens/login.dart';
void main() => runApp(MySoftballTeam());
class MySoftballTeam extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'My Softball Team',
theme: ThemeData(
primaryColor: Colors.indigo,
accentColor: Colors.indigoAccent,
fontFamily: 'sourcesanspro',
),
home: CheckLogin(),
debugShowCheckedModeBanner: false,
routes: <String, WidgetBuilder>{
'/HomeScreen': (BuildContext context) => HomeScreen(),
'/Signup': (BuildContext context) => Signup(),
'/AddNewGame': (BuildContext context) => AddNewGame(),
'/AddNewPlayer': (BuildContext context) => AddNewPlayer(),
'/SeasonSchedule': (BuildContext context) => SeasonSchedule(),
'/LoginPage': (BuildContext context) => LoginPage(),
'/PreviousGamesTable': (BuildContext context) => PreviousGamesList(),
'/EmailList': (BuildContext context) => EmailList(),
},
);
}
} | 0 |
mirrored_repositories/MySoftballTeam/lib | mirrored_repositories/MySoftballTeam/lib/widgets/GroovinDropdownButton.dart | // Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:math' as math;
import 'package:flutter/widgets.dart';
import 'package:flutter/material.dart';
const Duration _kDropdownMenuDuration = Duration(milliseconds: 300);
const double _kMenuItemHeight = 48.0;
const double _kDenseButtonHeight = 24.0;
const EdgeInsets _kMenuItemPadding = EdgeInsets.symmetric(horizontal: 16.0);
const EdgeInsetsGeometry _kAlignedButtonPadding =
EdgeInsetsDirectional.only(start: 16.0, end: 4.0);
const EdgeInsets _kUnalignedButtonPadding = EdgeInsets.zero;
const EdgeInsets _kAlignedMenuMargin = EdgeInsets.zero;
const EdgeInsetsGeometry _kUnalignedMenuMargin =
EdgeInsetsDirectional.only(start: 16.0, end: 24.0);
class _DropdownMenuPainter extends CustomPainter {
_DropdownMenuPainter({
this.color,
this.elevation,
this.selectedIndex,
this.resize,
}) : _painter = BoxDecoration(
// If you add an image here, you must provide a real
// configuration in the paint() function and you must provide some sort
// of onChanged callback here.
color: color,
borderRadius: BorderRadius.circular(2.0),
boxShadow: kElevationToShadow[elevation])
.createBoxPainter(),
super(repaint: resize);
final Color color;
final int elevation;
final int selectedIndex;
final Animation<double> resize;
final BoxPainter _painter;
@override
void paint(Canvas canvas, Size size) {
final double selectedItemOffset =
selectedIndex * _kMenuItemHeight + kMaterialListPadding.top;
final Tween<double> top = Tween<double>(
begin: selectedItemOffset.clamp(0.0, size.height - _kMenuItemHeight),
end: 0.0,
);
final Tween<double> bottom = Tween<double>(
begin:
(top.begin + _kMenuItemHeight).clamp(_kMenuItemHeight, size.height),
end: size.height,
);
final Rect rect = Rect.fromLTRB(
0.0, top.evaluate(resize), size.width, bottom.evaluate(resize));
_painter.paint(canvas, rect.topLeft, ImageConfiguration(size: rect.size));
}
@override
bool shouldRepaint(_DropdownMenuPainter oldPainter) {
return oldPainter.color != color ||
oldPainter.elevation != elevation ||
oldPainter.selectedIndex != selectedIndex ||
oldPainter.resize != resize;
}
}
// Do not use the platform-specific default scroll configuration.
// Dropdown menus should never overscroll or display an overscroll indicator.
class _DropdownScrollBehavior extends ScrollBehavior {
const _DropdownScrollBehavior();
@override
TargetPlatform getPlatform(BuildContext context) =>
Theme.of(context).platform;
@override
Widget buildViewportChrome(
BuildContext context, Widget child, AxisDirection axisDirection) =>
child;
@override
ScrollPhysics getScrollPhysics(BuildContext context) =>
const ClampingScrollPhysics();
}
class _DropdownMenu<T> extends StatefulWidget {
const _DropdownMenu({
Key key,
this.padding,
this.route,
}) : super(key: key);
final _DropdownRoute<T> route;
final EdgeInsets padding;
@override
_DropdownMenuState<T> createState() => _DropdownMenuState<T>();
}
class _DropdownMenuState<T> extends State<_DropdownMenu<T>> {
CurvedAnimation _fadeOpacity;
CurvedAnimation _resize;
@override
void initState() {
super.initState();
// We need to hold these animations as state because of their curve
// direction. When the route's animation reverses, if we were to recreate
// the CurvedAnimation objects in build, we'd lose
// CurvedAnimation._curveDirection.
_fadeOpacity = CurvedAnimation(
parent: widget.route.animation,
curve: const Interval(0.0, 0.25),
reverseCurve: const Interval(0.75, 1.0),
);
_resize = CurvedAnimation(
parent: widget.route.animation,
curve: const Interval(0.25, 0.5),
reverseCurve: const Threshold(0.0),
);
}
@override
Widget build(BuildContext context) {
// The menu is shown in three stages (unit timing in brackets):
// [0s - 0.25s] - Fade in a rect-sized menu container with the selected item.
// [0.25s - 0.5s] - Grow the otherwise empty menu container from the center
// until it's big enough for as many items as we're going to show.
// [0.5s - 1.0s] Fade in the remaining visible items from top to bottom.
//
// When the menu is dismissed we just fade the entire thing out
// in the first 0.25s.
assert(debugCheckHasMaterialLocalizations(context));
final MaterialLocalizations localizations =
MaterialLocalizations.of(context);
final _DropdownRoute<T> route = widget.route;
final double unit = 0.5 / (route.items.length + 1.5);
final List<Widget> children = <Widget>[];
for (int itemIndex = 0; itemIndex < route.items.length; ++itemIndex) {
CurvedAnimation opacity;
if (itemIndex == route.selectedIndex) {
opacity = CurvedAnimation(
parent: route.animation, curve: const Threshold(0.0));
} else {
final double start = (0.5 + (itemIndex + 1) * unit).clamp(0.0, 1.0);
final double end = (start + 1.5 * unit).clamp(0.0, 1.0);
opacity = CurvedAnimation(
parent: route.animation, curve: Interval(start, end));
}
children.add(FadeTransition(
opacity: opacity,
child: InkWell(
child: Container(
padding: widget.padding,
child: route.items[itemIndex],
),
onTap: () => Navigator.pop(
context,
_DropdownRouteResult<T>(route.items[itemIndex].value),
),
),
));
}
return FadeTransition(
opacity: _fadeOpacity,
child: CustomPaint(
painter: _DropdownMenuPainter(
color: Theme.of(context).canvasColor,
elevation: route.elevation,
selectedIndex: route.selectedIndex,
resize: _resize,
),
child: Semantics(
scopesRoute: true,
namesRoute: true,
explicitChildNodes: true,
label: localizations.popupMenuLabel,
child: Material(
type: MaterialType.transparency,
textStyle: route.style,
child: ScrollConfiguration(
behavior: const _DropdownScrollBehavior(),
child: Scrollbar(
child: ListView(
controller: widget.route.scrollController,
padding: kMaterialListPadding,
itemExtent: _kMenuItemHeight,
shrinkWrap: true,
children: children,
),
),
),
),
),
),
);
}
}
class _DropdownMenuRouteLayout<T> extends SingleChildLayoutDelegate {
_DropdownMenuRouteLayout({
@required this.buttonRect,
@required this.menuTop,
@required this.menuHeight,
@required this.textDirection,
});
final Rect buttonRect;
final double menuTop;
final double menuHeight;
final TextDirection textDirection;
@override
BoxConstraints getConstraintsForChild(BoxConstraints constraints) {
// The maximum height of a simple menu should be one or more rows less than
// the view height. This ensures a tappable area outside of the simple menu
// with which to dismiss the menu.
// -- https://material.google.com/components/menus.html#menus-simple-menus
final double maxHeight =
math.max(0.0, constraints.maxHeight - 2 * _kMenuItemHeight);
// The width of a menu should be at most the view width. This ensures that
// the menu does not extend past the left and right edges of the screen.
final double width = math.min(constraints.maxWidth, buttonRect.width);
return BoxConstraints(
minWidth: width,
maxWidth: width,
minHeight: 0.0,
maxHeight: maxHeight,
);
}
@override
Offset getPositionForChild(Size size, Size childSize) {
assert(() {
final Rect container = Offset.zero & size;
if (container.intersect(buttonRect) == buttonRect) {
// If the button was entirely on-screen, then verify
// that the menu is also on-screen.
// If the button was a bit off-screen, then, oh well.
assert(menuTop >= 0.0);
assert(menuTop + menuHeight <= size.height);
}
return true;
}());
assert(textDirection != null);
double left;
switch (textDirection) {
case TextDirection.rtl:
left = buttonRect.right.clamp(0.0, size.width) - childSize.width;
break;
case TextDirection.ltr:
left = buttonRect.left.clamp(0.0, size.width - childSize.width);
break;
}
return Offset(left, menuTop);
}
@override
bool shouldRelayout(_DropdownMenuRouteLayout<T> oldDelegate) {
return buttonRect != oldDelegate.buttonRect ||
menuTop != oldDelegate.menuTop ||
menuHeight != oldDelegate.menuHeight ||
textDirection != oldDelegate.textDirection;
}
}
// We box the return value so that the return value can be null. Otherwise,
// canceling the route (which returns null) would get confused with actually
// returning a real null value.
class _DropdownRouteResult<T> {
const _DropdownRouteResult(this.result);
final T result;
@override
bool operator ==(dynamic other) {
if (other is! _DropdownRouteResult<T>) return false;
final _DropdownRouteResult<T> typedOther = other;
return result == typedOther.result;
}
@override
int get hashCode => result.hashCode;
}
class _DropdownRoute<T> extends PopupRoute<_DropdownRouteResult<T>> {
_DropdownRoute({
this.items,
this.padding,
this.buttonRect,
this.selectedIndex,
this.elevation = 8,
this.theme,
@required this.style,
this.barrierLabel,
}) : assert(style != null);
final List<DropdownMenuItem<T>> items;
final EdgeInsetsGeometry padding;
final Rect buttonRect;
final int selectedIndex;
final int elevation;
final ThemeData theme;
final TextStyle style;
ScrollController scrollController;
@override
Duration get transitionDuration => _kDropdownMenuDuration;
@override
bool get barrierDismissible => true;
@override
Color get barrierColor => null;
@override
final String barrierLabel;
@override
Widget buildPage(BuildContext context, Animation<double> animation,
Animation<double> secondaryAnimation) {
assert(debugCheckHasDirectionality(context));
final double screenHeight = MediaQuery.of(context).size.height;
final double maxMenuHeight = screenHeight - 2.0 * _kMenuItemHeight;
final double buttonTop = buttonRect.top;
final double buttonBottom = buttonRect.bottom;
// If the button is placed on the bottom or top of the screen, its top or
// bottom may be less than [_kMenuItemHeight] from the edge of the screen.
// In this case, we want to change the menu limits to align with the top
// or bottom edge of the button.
final double topLimit = math.min(_kMenuItemHeight, buttonTop);
final double bottomLimit =
math.max(screenHeight - _kMenuItemHeight, buttonBottom);
final double selectedItemOffset =
selectedIndex * _kMenuItemHeight + kMaterialListPadding.top;
double menuTop = (buttonTop - selectedItemOffset) -
(_kMenuItemHeight - buttonRect.height) / 2.0;
final double preferredMenuHeight =
(items.length * _kMenuItemHeight) + kMaterialListPadding.vertical;
// If there are too many elements in the menu, we need to shrink it down
// so it is at most the maxMenuHeight.
final double menuHeight = math.min(maxMenuHeight, preferredMenuHeight);
double menuBottom = menuTop + menuHeight;
// If the computed top or bottom of the menu are outside of the range
// specified, we need to bring them into range. If the item height is larger
// than the button height and the button is at the very bottom or top of the
// screen, the menu will be aligned with the bottom or top of the button
// respectively.
if (menuTop < topLimit) menuTop = math.min(buttonTop, topLimit);
if (menuBottom > bottomLimit) {
menuBottom = math.max(buttonBottom, bottomLimit);
menuTop = menuBottom - menuHeight;
}
if (scrollController == null) {
// The limit is asymmetrical because we do not care how far positive the
// limit goes. We are only concerned about the case where the value of
// [buttonTop - menuTop] is larger than selectedItemOffset, ie. when
// the button is close to the bottom of the screen and the selected item
// is close to 0.
final double scrollOffset = preferredMenuHeight > maxMenuHeight
? math.max(0.0, selectedItemOffset - (buttonTop - menuTop))
: 0.0;
scrollController = ScrollController(initialScrollOffset: scrollOffset);
}
final TextDirection textDirection = Directionality.of(context);
Widget menu = _DropdownMenu<T>(
route: this,
padding: padding.resolve(textDirection),
);
if (theme != null) menu = Theme(data: theme, child: menu);
return MediaQuery.removePadding(
context: context,
removeTop: true,
removeBottom: true,
removeLeft: true,
removeRight: true,
child: Builder(
builder: (BuildContext context) {
return CustomSingleChildLayout(
delegate: _DropdownMenuRouteLayout<T>(
buttonRect: buttonRect,
menuTop: menuTop,
menuHeight: menuHeight,
textDirection: textDirection,
),
child: menu,
);
},
),
);
}
void _dismiss() {
navigator?.removeRoute(this);
}
}
/// A material design button for selecting from a list of items.
///
/// A dropdown button lets the user select from a number of items. The button
/// shows the currently selected item as well as an arrow that opens a menu for
/// selecting another item.
///
/// The type `T` is the type of the values the dropdown menu represents. All the
/// entries in a given menu must represent values with consistent types.
/// Typically, an enum is used. Each [DropdownMenuItem] in [items] must be
/// specialized with that same type argument.
///
/// Requires one of its ancestors to be a [Material] widget.
///
/// See also:
///
/// * [DropdownMenuItem], the class used to represent the [items].
/// * [DropdownButtonHideUnderline], which prevents its descendant dropdown buttons
/// from displaying their underlines.
/// * [RaisedButton], [FlatButton], ordinary buttons that trigger a single action.
/// * <https://material.google.com/components/buttons.html#buttons-dropdown-buttons>
class GroovinDropdownButton<T> extends StatefulWidget {
/// Creates a dropdown button.
///
/// The [items] must have distinct values and if [value] isn't null it must be among them.
/// If [items] or [onChanged] is null, the button will be disabled, the down arrow will be grayed out, and
/// the [disabledHint] will be shown (if provided).
///
/// The [elevation] and [iconSize] arguments must not be null (they both have
/// defaults, so do not need to be specified).
GroovinDropdownButton({
Key key,
@required this.items,
this.value,
this.hint,
this.disabledHint,
@required this.onChanged,
this.elevation = 8,
this.style,
this.iconSize = 24.0,
this.iconColor = Colors.grey,
this.isDense = false,
this.isExpanded = false,
}) : assert(items == null || value == null ||
items.where((DropdownMenuItem<T> item) => item.value == value).length == 1),
super(key: key);
/// The list of possible items to select among.
final List<DropdownMenuItem<T>> items;
/// The currently selected item, or null if no item has been selected. If
/// value is null then the menu is popped up as if the first item was
/// selected.
final T value;
/// Displayed if [value] is null.
final Widget hint;
/// A message to show when the dropdown is disabled.
///
/// Displayed if [items] or [onChanged] is null.
final Widget disabledHint;
/// Called when the user selects an item.
final ValueChanged<T> onChanged;
/// The z-coordinate at which to place the menu when open.
///
/// The following elevations have defined shadows: 1, 2, 3, 4, 6, 8, 9, 12, 16, 24
///
/// Defaults to 8, the appropriate elevation for dropdown buttons.
final int elevation;
/// The text style to use for text in the dropdown button and the dropdown
/// menu that appears when you tap the button.
///
/// Defaults to the [TextTheme.subhead] value of the current
/// [ThemeData.textTheme] of the current [Theme].
final TextStyle style;
/// The size to use for the drop-down button's down arrow icon button.
///
/// Defaults to 24.0.
final double iconSize;
final Color iconColor;
/// Reduce the button's height.
///
/// By default this button's height is the same as its menu items' heights.
/// If isDense is true, the button's height is reduced by about half. This
/// can be useful when the button is embedded in a container that adds
/// its own decorations, like [InputDecorator].
final bool isDense;
/// Set the dropdown's inner contents to horizontally fill its parent.
///
/// By default this button's inner width is the minimum size of its contents.
/// If [isExpanded] is true, the inner width is expanded to fill its
/// surrounding container.
final bool isExpanded;
@override
_GroovinDropdownButtonState<T> createState() =>
_GroovinDropdownButtonState<T>();
}
class _GroovinDropdownButtonState<T> extends State<GroovinDropdownButton<T>>
with WidgetsBindingObserver {
int _selectedIndex;
_DropdownRoute<T> _dropdownRoute;
@override
void initState() {
super.initState();
_updateSelectedIndex();
WidgetsBinding.instance.addObserver(this);
}
@override
void dispose() {
WidgetsBinding.instance.removeObserver(this);
_removeDropdownRoute();
super.dispose();
}
// Typically called because the device's orientation has changed.
// Defined by WidgetsBindingObserver
@override
void didChangeMetrics() {
_removeDropdownRoute();
}
void _removeDropdownRoute() {
_dropdownRoute?._dismiss();
_dropdownRoute = null;
}
@override
void didUpdateWidget(GroovinDropdownButton<T> oldWidget) {
super.didUpdateWidget(oldWidget);
_updateSelectedIndex();
}
void _updateSelectedIndex() {
if (!_enabled) {
return;
}
assert(widget.value == null ||
widget.items
.where((DropdownMenuItem<T> item) => item.value == widget.value)
.length ==
1);
_selectedIndex = null;
for (int itemIndex = 0; itemIndex < widget.items.length; itemIndex++) {
if (widget.items[itemIndex].value == widget.value) {
_selectedIndex = itemIndex;
return;
}
}
}
TextStyle get _textStyle =>
widget.style ?? Theme.of(context).textTheme.subhead;
void _handleTap() {
final RenderBox itemBox = context.findRenderObject();
final Rect itemRect = itemBox.localToGlobal(Offset.zero) & itemBox.size;
final TextDirection textDirection = Directionality.of(context);
final EdgeInsetsGeometry menuMargin =
ButtonTheme.of(context).alignedDropdown
? _kAlignedMenuMargin
: _kUnalignedMenuMargin;
assert(_dropdownRoute == null);
_dropdownRoute = _DropdownRoute<T>(
items: widget.items,
buttonRect: menuMargin.resolve(textDirection).inflateRect(itemRect),
padding: _kMenuItemPadding.resolve(textDirection),
selectedIndex: _selectedIndex ?? 0,
elevation: widget.elevation,
theme: Theme.of(context, shadowThemeOnly: true),
style: _textStyle,
barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel,
);
Navigator.push(context, _dropdownRoute)
.then<void>((_DropdownRouteResult<T> newValue) {
_dropdownRoute = null;
if (!mounted || newValue == null) return;
if (widget.onChanged != null) widget.onChanged(newValue.result);
});
}
// When isDense is true, reduce the height of this button from _kMenuItemHeight to
// _kDenseButtonHeight, but don't make it smaller than the text that it contains.
// Similarly, we don't reduce the height of the button so much that its icon
// would be clipped.
double get _denseButtonHeight {
return math.max(
_textStyle.fontSize, math.max(widget.iconSize, _kDenseButtonHeight));
}
Color get _downArrowColor {
// These colors are not defined in the Material Design spec.
if (_enabled) {
if (Theme.of(context).brightness == Brightness.light) {
return Colors.grey.shade700;
} else {
return Colors.white70;
}
} else {
if (Theme.of(context).brightness == Brightness.light) {
return Colors.grey.shade400;
} else {
return Colors.white10;
}
}
}
bool get _enabled =>
widget.items != null &&
widget.items.isNotEmpty &&
widget.onChanged != null;
@override
Widget build(BuildContext context) {
assert(debugCheckHasMaterial(context));
assert(debugCheckHasMaterialLocalizations(context));
// The width of the button and the menu are defined by the widest
// item and the width of the hint.
final List<Widget> items =
_enabled ? List<Widget>.from(widget.items) : <Widget>[];
int hintIndex;
if (widget.hint != null || (!_enabled && widget.disabledHint != null)) {
final Widget emplacedHint = _enabled
? widget.hint
: DropdownMenuItem<Widget>(child: widget.disabledHint ?? widget.hint);
hintIndex = items.length;
items.add(DefaultTextStyle(
style: _textStyle.copyWith(color: Theme.of(context).hintColor),
child: IgnorePointer(
child: emplacedHint,
ignoringSemantics: false,
),
));
}
final EdgeInsetsGeometry padding = ButtonTheme.of(context).alignedDropdown
? _kAlignedButtonPadding
: _kUnalignedButtonPadding;
// If value is null (then _selectedIndex is null) or if disabled then we
// display the hint or nothing at all.
final IndexedStack innerItemsWidget = IndexedStack(
index: _enabled ? (_selectedIndex ?? hintIndex) : hintIndex,
alignment: AlignmentDirectional.centerStart,
children: items,
);
Widget result = DefaultTextStyle(
style: _textStyle,
child: Container(
padding: padding.resolve(Directionality.of(context)),
height: widget.isDense ? _denseButtonHeight : null,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
widget.isExpanded
? Expanded(child: innerItemsWidget)
: innerItemsWidget,
Icon(
Icons.arrow_drop_down,
size: widget.iconSize,
color: widget.iconColor,
),
],
),
),
);
if (!DropdownButtonHideUnderline.at(context)) {
final double bottom = widget.isDense ? 0.0 : 8.0;
result = Stack(
children: <Widget>[
result,
Positioned(
left: 0.0,
right: 0.0,
bottom: bottom,
child: Container(
height: 1.0,
decoration: const BoxDecoration(
border: Border(
bottom: BorderSide(color: Color(0xFFBDBDBD), width: 0.0),
),
),
),
),
],
);
}
return Semantics(
button: true,
child: GestureDetector(
onTap: _enabled ? _handleTap : null,
behavior: HitTestBehavior.opaque,
child: result),
);
}
}
| 0 |
mirrored_repositories/MySoftballTeam/lib | mirrored_repositories/MySoftballTeam/lib/screens/home_screen.dart | import 'package:async/async.dart';
import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:my_softball_team/screens/SeasonSchedule/season_schedule.dart';
import 'package:my_softball_team/screens/TeamList/team_list.dart';
import 'package:my_softball_team/screens/StatsLeaderboard/leaderboard_home.dart';
import 'package:my_softball_team/globals.dart' as globals;
import 'package:shared_preferences/shared_preferences.dart';
import 'package:groovin_material_icons/groovin_material_icons.dart';
import 'package:outline_material_icons/outline_material_icons.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:package_info/package_info.dart';
import 'dart:async';
import 'package:rounded_modal/rounded_modal.dart';
import 'package:groovin_widgets/groovin_widgets.dart';
class HomeScreen extends StatefulWidget {
@override
_HomeScreenState createState() => _HomeScreenState();
}
class _HomeScreenState extends State<HomeScreen> {
// Set initial package info
PackageInfo _packageInfo = PackageInfo(
appName: 'Unknown',
packageName: 'Unknown',
version: 'Unknown',
buildNumber: 'Unknown',
);
// Get and set the package details
Future getPackageDetails() async{
final PackageInfo info = await PackageInfo.fromPlatform();
setState(() {
_packageInfo = info;
});
}
// List of bottom navigation bar items
List<BottomNavigationBarItem> _bottomNavigationBarItems = [
BottomNavigationBarItem(
icon: Icon(GroovinMaterialIcons.calendar_text),
title: Text(
"Schedule",
style: TextStyle(
fontWeight: FontWeight.bold,
),
),
),
BottomNavigationBarItem(
icon: Icon(GroovinMaterialIcons.account_multiple_outline),
title: Text(
"Team",
style: TextStyle(
fontWeight: FontWeight.bold,
),
),
),
BottomNavigationBarItem(
icon: Icon(OMIcons.assessment),
title: Text(
"Stats",
style: TextStyle(
fontWeight: FontWeight.bold,
),
),
),
];
int _page = 0; // tracks what page is currently in view
PageController _pageController;
// Navigate pages based on bottom navigation bar item tap
void navigationTapped(int page) {
_pageController.animateToPage(
page,
duration: const Duration(milliseconds: 300),
curve: Curves.ease,
);
}
// Track which page is in view
void _onPageChanged(int page) {
setState(() {
this._page = page;
});
}
@override
void initState() {
super.initState();
getPackageDetails();
_pageController = PageController();
}
@override
void dispose() {
super.dispose();
_pageController.dispose();
}
@override
Widget build(BuildContext context) {
// List of FloatingActionButtons to show only on 'Games' and 'Team' pages
List<Widget> _fabs = [
FloatingActionButton.extended(
onPressed: () {
Navigator.of(context).pushNamed('/AddNewGame');
},
icon: Icon(Icons.add),
label: Text("New Game"),
),
FloatingActionButton.extended(
onPressed: () {
Navigator.of(context).pushNamed('/AddNewPlayer');
},
icon: Icon(Icons.add),
label: Text("New Player"),
),
Container()
];
CollectionReference usersDB = Firestore.instance.collection("Users");
return Scaffold (
appBar: AppBar(
centerTitle: true,
elevation: 0.0,
backgroundColor: Theme.of(context).canvasColor,
title: StreamBuilder<List<QuerySnapshot>>(
stream: StreamZip([usersDB.snapshots(), globals.gamesDB.snapshots()]),
builder: (context, snapshot) {
if(snapshot.hasData){
final usersStream = snapshot.data[0];
final gamesStream = snapshot.data[1];
List<DocumentSnapshot> users = usersStream.documents;
List<DocumentSnapshot> games = gamesStream.documents;
int wins = 0;
int losses = 0;
for(int index = 0; index < users.length; index++) {
if (users[index].documentID == globals.loggedInUser.uid) {
DocumentSnapshot team = users[index];
globals.teamName = "${team['Team']}";
for(int index2 = 0; index2 < games.length; index2++) {
DocumentSnapshot game = games[index2];
String winOrLoss = "${game['WinOrLoss']}";
if(winOrLoss == null){
} else if(winOrLoss == "Unknown") {
} else if(winOrLoss == "Win") {
wins += 1;
} else if(winOrLoss == "Loss") {
losses += 1;
} else if(winOrLoss == "Tie") {
}
}
return Text(
globals.teamName + " (" + DateTime.now().year.toString() + ") " + wins.toString() + " - " + losses.toString(),
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold
),
);
}
}
} else {
return Text(
"MySoftballTeam",
style: TextStyle(
color: Colors.black
),
);
}
},
),
actions: <Widget>[
IconButton(
icon: Icon(Icons.more_vert),
onPressed: (){
showRoundedModalBottomSheet(
context: context,
dismissOnTap: false,
builder: (builder){
return Container(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Padding(
padding: const EdgeInsets.all(8.0),
child: ModalDrawerHandle(
handleColor: Colors.grey,
),
),
ListTile(
leading: Icon(OMIcons.accountCircle),
title: Text(globals.loggedInUser.email),
),
Divider(
height: 0.0,
color: Colors.grey,
),
Material(
child: ListTile(
leading: Icon(Icons.history),
title: Text("View Previous Games"),
onTap: (){
Navigator.pop(context);
Navigator.of(context).pushNamed('/PreviousGamesTable');
},
),
),
Material(
child: ListTile(
leading: Icon(OMIcons.email),
title: Text("Email List"),
onTap: (){
Navigator.pop(context);
Navigator.of(context).pushNamed('/EmailList');
},
),
),
Material(
child: ListTile(
leading: Icon(GroovinMaterialIcons.logout),
title: Text("Log Out"),
onTap: () async {
FirebaseAuth.instance.signOut();
SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.setString("Team", "");
Navigator.of(context).pushNamedAndRemoveUntil('/LoginPage',(Route<dynamic> route) => false);
},
),
),
Divider(
height: 0.0,
color: Colors.grey,
),
ListTile(
leading: Icon(OMIcons.info),
title: Text("MySoftballTeam by GroovinChip"),
subtitle: Text("Version " + _packageInfo.version),
),
Material(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
IconButton(
icon: Icon(GroovinMaterialIcons.twitter, color: Colors.blue),
onPressed: (){
launch("https:twitter.com/GroovinChipDev");
},
),
IconButton(
icon: Icon(GroovinMaterialIcons.github_circle),
onPressed: (){
launch("https:github.com/GroovinChip");
},
),
IconButton(
icon: Icon(GroovinMaterialIcons.gmail),
color: Colors.red,
onPressed: (){
launch("mailto:[email protected]");
},
),
IconButton(
icon: Icon(GroovinMaterialIcons.discord, color: Colors.deepPurpleAccent),
onPressed: (){
launch("https://discord.gg/CFnBRue");
},
),
/*IconButton(
icon: Icon(GroovinMaterialIcons.flutter),
color: Colors.blue,
onPressed: (){
},
),*/
],
),
),
],
),
);
},
);
},
),
],
iconTheme: IconThemeData(color: Colors.black),
),
body: PageView(
children: <Widget>[
SeasonSchedule(),
TeamList(),
LeaderboardHome()
],
controller: _pageController,
onPageChanged: _onPageChanged,
physics: const NeverScrollableScrollPhysics(),
),
floatingActionButton: _fabs[_page],
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
bottomNavigationBar: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
BottomNavigationBar(
items: _bottomNavigationBarItems,
currentIndex: _page,
onTap: navigationTapped,
),
],
),
);
}
}
| 0 |
mirrored_repositories/MySoftballTeam/lib | mirrored_repositories/MySoftballTeam/lib/screens/login.dart | import 'dart:async';
import 'package:flutter/material.dart';
import 'package:firebase_auth/firebase_auth.dart' show FirebaseAuth, FirebaseUser;
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/services.dart';
import 'package:my_softball_team/globals.dart' as globals;
import 'package:shared_preferences/shared_preferences.dart';
class LoginPage extends StatefulWidget {
@override
_LoginPageState createState() => _LoginPageState();
}
class _LoginPageState extends State<LoginPage> {
// Controllers
TextEditingController _emailController = TextEditingController();
TextEditingController _passwordController = TextEditingController();
// Variables
var email;
var password;
String teamName;
bool isChecked = false;
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey,
backgroundColor: Colors.indigo,
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.only(top: 100.0),
child: StreamBuilder<QuerySnapshot>(
stream: globals.usersDB.snapshots(),
builder: (context, snapshot) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
"MySoftballTeam",
style: TextStyle(fontSize: 30.0, color: Colors.white),
),
SizedBox(
height: 25.0,
),
Padding(
padding: const EdgeInsets.all(16.0),
child: Card(
elevation: 4.0,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
SizedBox(
height: 25.0,
),
TextField(
decoration: InputDecoration(
prefixIcon: Icon(Icons.email),
labelText: "Email Address",
border: OutlineInputBorder(),
),
keyboardType: TextInputType.emailAddress,
controller: _emailController,
),
SizedBox(
height: 25.0,
),
TextField(
decoration: InputDecoration(
prefixIcon: Icon(Icons.lock),
labelText: "Password",
border: OutlineInputBorder(),
),
obscureText: true,
controller: _passwordController,
),
SizedBox(
height: 25.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
RaisedButton(
onPressed: () {
Navigator.of(context).pushNamed('/Signup');
},
color: Colors.indigoAccent,
child: Text(
"Create Account",
style: TextStyle(
color: Colors.white,
),
),
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Builder(
builder: (BuildContext loginButtonContext) {
return RaisedButton(
onPressed: () async {
email = _emailController.text;
password = _passwordController.text;
// try to sign in using the user's credentials
try {
final firebaseUser = await FirebaseAuth.instance.signInWithEmailAndPassword(email: email, password: password);
if (firebaseUser.isEmailVerified == true) {
_scaffoldKey.currentState.showSnackBar(
SnackBar(
duration: Duration(seconds: 2),
content:
Row(
children: <Widget>[
CircularProgressIndicator(),
Text(" Signing-In...")
],
),
)
);
globals.loggedInUser = firebaseUser; // add user to globals
List<DocumentSnapshot> users = snapshot.data.documents;
for(int index = 0; index < users.length; index++) {
if (users[index].documentID == globals.loggedInUser.uid) {
DocumentSnapshot team = users[index];
globals.teamName = "${team['Team']}";
}
}
SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.setString("Team", globals.teamName);
await Future.delayed(const Duration(seconds : 2));
Navigator.of(context).pushNamedAndRemoveUntil('/HomeScreen',(Route<dynamic> route) => false);
} else {
showDialog(
context: context,
builder: (_) => SimpleDialog(
title: Text(
"Your email address is not verified"),
children: <Widget>[
Row(
children: <Widget>[
Padding(
padding:
const EdgeInsets.only(left: 24.0, top: 16.0, bottom: 16.0),
child: Text(
"Would you like another verificaion email sent?"),
)
],
),
Row(
mainAxisAlignment:
MainAxisAlignment.end,
children: <Widget>[
FlatButton(
onPressed: () {
Navigator.pop(context);
},
child:
Text("No")),
FlatButton(
onPressed: () {
firebaseUser.sendEmailVerification();
Navigator.pop(context);
},
child:
Text("Yes")
),
],
)
],
));
}
} catch (e) {
final snackBar = SnackBar(
content: Text(
"Email or Password not found, please try again."),
action: SnackBarAction(
label: 'Dismiss',
onPressed: () {},
),
duration: Duration(seconds: 3),
);
Scaffold
.of(loginButtonContext)
.showSnackBar(snackBar);
}
},
color: Colors.indigoAccent,
child: Text(
"Login",
style: TextStyle(
color: Colors.white,
),
),
);
}),
),
],
),
],
),
),
),
)
],
),
);
},
),
),
),
);
}
}
| 0 |
mirrored_repositories/MySoftballTeam/lib | mirrored_repositories/MySoftballTeam/lib/screens/previous_games_list.dart | import 'package:groovin_material_icons/groovin_material_icons.dart';
import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart' ;
import 'package:my_softball_team/globals.dart' as globals;
import 'package:my_softball_team/screens/SeasonSchedule/edit_game.dart';
import 'package:my_softball_team/screens/SeasonSchedule/game_card.dart';
class PreviousGamesList extends StatefulWidget {
@override
_PreviousGamesListState createState() => _PreviousGamesListState();
}
class _PreviousGamesListState extends State<PreviousGamesList> {
DateTime today = DateTime.now();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 0.0,
centerTitle: true,
backgroundColor: Theme.of(context).canvasColor,
title: Text("Previous Games",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
iconTheme: IconThemeData(color: Colors.black),
),
body: StreamBuilder<QuerySnapshot>(
stream: Firestore.instance.collection("Teams").document(globals.teamName).collection("Seasons").document(DateTime.now().year.toString()).collection("Games").snapshots(),
builder: (context, snapshot){
List<Widget> gameCards = [];
if(snapshot.hasData == false) {
return Center(child: Text("No Games Found"));
} else {
List<DocumentSnapshot> games = snapshot.data.documents;
games.sort((a, b){
DateTime game1 = globals.convertStringDateToDateTime(a['GameDate'], a['GameTime']);
DateTime game2 = globals.convertStringDateToDateTime(b['GameDate'], b['GameTime']);
return game1.compareTo(game2);
});
for(int index = 0; index < games.length; index++){
// Check each game date - if the date is before today, create a GameCard
DateTime gameDate = globals.convertStringDateToDateTime("${games[index]['GameDate']}", "${games[index]['GameTime']}");
if(gameDate.isBefore(today) == false){
// do not create a GameCard
} else {
gameCards.add(
Padding(
padding: const EdgeInsets.all(8.0),
child: GameCard(
gameID: games[index].documentID,
homeOrAway: "${games[index]['HomeOrAway']}",
teamName: globals.teamName,
opposingTeam: "${games[index]['OpposingTeam']}",
gameTime: "${games[index]['GameTime']}",
gameDate: "${games[index]['GameDate']}",
gameLocation: "${games[index]['GameLocation']}",
isPreviousGame: true,
),
),
);
}
}
return gameCards.length > 0 ? ListView.builder(
itemCount: gameCards.length,
itemBuilder: (context, index){
return gameCards[index];
},
) :
Center(
child: Padding(
padding: const EdgeInsets.only(bottom: 75.0),
child: Text("No previous games"),
),
);
}
},
),
);
}
}
| 0 |
mirrored_repositories/MySoftballTeam/lib | mirrored_repositories/MySoftballTeam/lib/screens/signup.dart | import 'dart:async';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:my_softball_team/globals.dart' as globals;
import 'package:shared_preferences/shared_preferences.dart';
class Signup extends StatefulWidget {
@override
_SignupState createState() => _SignupState();
}
class _SignupState extends State<Signup> {
// Controllers
TextEditingController _nameController = TextEditingController();
TextEditingController _emailController = TextEditingController();
TextEditingController _passwordController = TextEditingController();
TextEditingController _teamNameController = TextEditingController();
// Variables
var name;
var email;
var password;
var _team;
var list;
// Set team on DropdownButton tap
void _chooseTeam(value) {
setState(() {
_team = value;
});
}
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
@override
Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey,
backgroundColor: Colors.indigo,
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.only(top: 100.0),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
"Create Account",
style: TextStyle(
fontSize: 30.0,
color: Colors.white
),
),
SizedBox(
height: 25.0,
),
Padding(
padding: const EdgeInsets.all(16.0),
child: Card(
elevation: 4.0,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: <Widget>[
SizedBox(
height: 10.0,
),
TextField(
decoration: InputDecoration(
prefixIcon: Icon(Icons.person),
labelText: "*Name",
border: OutlineInputBorder(),
),
controller: _nameController,
keyboardType: TextInputType.text,
),
SizedBox(
height: 25.0,
),
TextField(
decoration: InputDecoration(
prefixIcon: Icon(Icons.email),
labelText: "*Email Address",
border: OutlineInputBorder(),
),
controller: _emailController,
keyboardType: TextInputType.emailAddress,
),
SizedBox(
height: 25.0,
),
TextField(
decoration: InputDecoration(
prefixIcon: Icon(Icons.lock),
border: OutlineInputBorder(),
labelText: "*Password",
),
obscureText: true,
controller: _passwordController,
),
SizedBox(
height: 25.0,
),
Row(
children: <Widget>[
Icon(Icons.group, color: Colors.black45,),
SizedBox(
width: 15.0,
),
Expanded(
child: StreamBuilder<QuerySnapshot>(
stream: Firestore.instance.collection("Teams").snapshots(),
builder: (context, snapshot){
// Check if the snapshot is null
if (snapshot.data == null) {
return CircularProgressIndicator();
}
// Return a dropdownbutton with all the teams from the database
return DropdownButton(
items: snapshot.data.documents.map((DocumentSnapshot document) {
return DropdownMenuItem(child: Text(document.documentID), value: document.documentID);
}).toList(),
onChanged: _chooseTeam,
hint: Text("Join a Team"),
value: _team,
isExpanded: true,
);
}
),
),
],
),
SizedBox(
height: 25.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
RaisedButton(
onPressed: (){
showDialog(
context: context,
builder: (_) => SimpleDialog(
title: Text("Add Your Team"),
children: <Widget>[
Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.all(16.0),
child: TextField(
decoration: InputDecoration(
prefixIcon: Icon(Icons.group, color: Colors.black45,),
labelText: "Team Name",
border: OutlineInputBorder(),
),
controller: _teamNameController,
),
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(right: 22.0),
child: StreamBuilder<QuerySnapshot>(
stream: Firestore.instance.collection("Teams").snapshots(),
builder: (context, snapshot) {
// Check if the snapshot is null
if (snapshot.data == null) {
return CircularProgressIndicator();
}
return RaisedButton(
onPressed: () async {
globals.teamName = _teamNameController.text; // add team name to globals
//_saveValuesToStorage(globals.teamTame);
// Add team name to database
if (globals.teamName != "") {
CollectionReference team = Firestore.instance.collection("Teams");
team.document(globals.teamName).setData({"TeamName":globals.teamName});
Navigator.pop(context);
} else {
}
},
color: Colors.indigoAccent,
child: Text("Add Team",
style: TextStyle(
color: Colors
.white),),
);
}
),
)
],
)
],
),
],
)
);
},
child: Text("I don't see my team",
style: TextStyle(
color: Colors.white,
),
),
color: Colors.purpleAccent,
),
RaisedButton( // Create Account button
onPressed: () async {
email = _emailController.text;
password = _passwordController.text;
if(email == '' || password == ''){
_scaffoldKey.currentState.showSnackBar(
SnackBar(
duration: Duration(seconds: 2),
content:
Row(
children: <Widget>[
Icon(Icons.error),
Text(" Please enter required fields")
],
),
)
);
}
name = _nameController.text;
// create the user
final firebaseUser = await FirebaseAuth.instance.createUserWithEmailAndPassword(email: email, password: password);
// add the user to the database
CollectionReference usersDB = Firestore.instance.collection("Users");
usersDB.document(firebaseUser.uid).setData({
"Name":name,
"Email":firebaseUser.email,
"Team":_team,
"StatTableSort":"AtBats",
});
// Add user to globals
globals.loggedInUser = firebaseUser;
_scaffoldKey.currentState.showSnackBar(
SnackBar(
duration: Duration(seconds: 2),
content:
Row(
children: <Widget>[
CircularProgressIndicator(),
Text(" Creating Account...")
],
),
)
);
firebaseUser.sendEmailVerification();
_scaffoldKey.currentState.showSnackBar(
SnackBar(
duration: Duration(seconds: 2),
content:
Row(
children: <Widget>[
CircularProgressIndicator(),
Text(" Sending Verification Email...")
],
),
)
);
await Future.delayed(const Duration(seconds : 3));
_scaffoldKey.currentState.showSnackBar(
SnackBar(
duration: Duration(seconds: 3),
content:
Row(
children: <Widget>[
CircularProgressIndicator(),
Text(" Logging In...")
],
),
)
);
await Future.delayed(const Duration(seconds : 3));
Navigator.of(context)
.pushNamedAndRemoveUntil('/HomeScreen', (Route<dynamic> route) => false);
},
color: Colors.indigoAccent,
child: Text(
"Create Account",
style: TextStyle(
color: Colors.white,
),
),
),
],
),
],
),
),
),
),
],
),
),
),
)
);
}
}
| 0 |
mirrored_repositories/MySoftballTeam/lib/screens | mirrored_repositories/MySoftballTeam/lib/screens/SeasonSchedule/game_card.dart | import 'dart:async';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:groovin_material_icons/groovin_material_icons.dart';
import 'package:flutter/material.dart';
import 'package:my_softball_team/globals.dart' as globals;
import 'package:my_softball_team/screens/SeasonSchedule/edit_game.dart';
import 'package:outline_material_icons/outline_material_icons.dart';
import 'package:flutter_email_sender/flutter_email_sender.dart';
import 'package:url_launcher/url_launcher.dart';
class GameCard extends StatefulWidget{
final String gameID;
final String homeOrAway;
final String teamName;
final String opposingTeam;
final String gameDate;
final String gameTime;
final String gameLocation;
final bool isPreviousGame;
GameCard({
this.gameID,
this.homeOrAway,
this.teamName,
this.opposingTeam,
this.gameDate,
this.gameTime,
this.gameLocation,
this.isPreviousGame
});
@override
GameCardState createState() {
return GameCardState();
}
}
class GameCardState extends State<GameCard> {
String fullText;
TextEditingController ownTeamScoreController = TextEditingController();
TextEditingController opposingTeamScoreController = TextEditingController();
@override
Widget build(BuildContext context) {
switch (widget.homeOrAway) {
case "Home":
fullText = widget.teamName + " VS " + widget.opposingTeam;
break;
case "Away":
fullText = widget.opposingTeam + " VS " + widget.teamName;
break;
case "Bye":
fullText = widget.homeOrAway;
break;
}
return Card(
elevation: 2.0,
//shape: OutlineInputBorder(borderRadius: BorderRadius.all(Radius.circular(10.0))),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 16.0, bottom: 6.0, top: 8.0),
child: Text(
fullText,
style: TextStyle(
fontSize: widget.isPreviousGame == false ? 22.0 : 20,
fontWeight: FontWeight.bold
),
),
),
Padding(
padding: const EdgeInsets.only(left: 16.0, bottom: 6.0),
child: Text(
widget.gameTime + " on " + widget.gameDate
),
),
Padding(
padding: const EdgeInsets.only(left: 16.0),
child: Text(
widget.gameLocation
),
),
// Check if this game is a previous game - if so, do not show the action row
(widget.isPreviousGame == false) ? Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
IconButton(
icon: Icon(Icons.delete_outline),
tooltip: "Delete game",
onPressed: () {
globals.selectedGameDocument = widget.gameID;
showDialog(
context: context,
builder: (_) =>
SimpleDialog(
title: Text("Delete Game"),
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: ListTile(
title: Text(
"Are you sure you want to remove this game from the schedule?"),
),
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
FlatButton(
child: Text("No", style: TextStyle(color: Theme.of(context).accentColor),),
onPressed: () {
Navigator.pop(context);
},
),
FlatButton(
child: Text("Yes", style: TextStyle(color: Theme.of(context).accentColor),),
onPressed: () {
globals.gamesDB.document(
globals.selectedGameDocument)
.delete();
Navigator.pop(context);
},
),
],
),
),
],
),
);
},
),
IconButton(
icon: Icon(GroovinMaterialIcons.edit_outline),
tooltip: "Edit game details",
onPressed: () {
globals.selectedGameDocument = widget.gameID;
Navigator.of(context).push(new MaterialPageRoute<Null>(
builder: (BuildContext context) {
return EditGame();
},
fullscreenDialog: true
));
},
),
IconButton(
icon: Icon(OMIcons.driveEta),
tooltip: "Drive to Game",
onPressed: () {
globals.selectedGameDocument = widget.gameID;
launch("https://www.google.com/maps/search/?api=1&query=" + widget.gameLocation);
},
),
StreamBuilder<QuerySnapshot>(
stream: Firestore.instance.collection("Teams").document(globals.teamName).collection("EmailList").snapshots(),
builder: (context, snapshot){
if(snapshot.hasData == false) {
return IconButton(
icon: Icon(OMIcons.email),
tooltip: "Send game reminder",
onPressed: () async {
},
);
} else {
List<String> emailAddresses = [];
for(int i = 0; i < snapshot.data.documents.length; i++){
DocumentSnapshot ds = snapshot.data.documents[i];
emailAddresses.add(ds.documentID);
}
String s = "";
emailAddresses.forEach((value) {
s += value + "; ";
});
return IconButton(
icon: Icon(OMIcons.email),
tooltip: "Send game reminder",
onPressed: () async {
final Email email = Email(
body: '',
subject: 'Game Today!',
recipients: emailAddresses,
);
await FlutterEmailSender.send(email);
},
);
}
},
),
Padding(
padding: const EdgeInsets.only(right: 8.0),
child: IconButton(
icon: Icon(GroovinMaterialIcons.trophy_variant_outline),
tooltip: "Record score",
onPressed: () {
showDialog(
context: context,
builder: (_) =>
SimpleDialog(
title: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text("Record Score")
],
),
children: <Widget>[
Column(
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween ,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 24.0),
child: Text(widget.teamName),
),
Padding(
padding: const EdgeInsets.only(right: 24.0),
child: SizedBox(
width: 25.0,
child: TextField(
controller: ownTeamScoreController,
keyboardType: TextInputType.number,
maxLength: 3,
),
),
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween ,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 24.0),
child: Text(widget.opposingTeam),
),
Padding(
padding: const EdgeInsets.only(right: 24.0),
child: SizedBox(
width: 25.0,
child: TextField(
controller: opposingTeamScoreController,
keyboardType: TextInputType.number,
maxLength: 3,
),
),
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FlatButton(
child: Text("Save", style: TextStyle(color: Colors.indigo),),
onPressed: () {
int ownScore = int.parse(ownTeamScoreController.text);
int opposingScore = int.parse(opposingTeamScoreController.text);
String winOrLoss;
if(ownScore > opposingScore){
winOrLoss = "Win";
} else {
winOrLoss = "Loss";
}
if(ownScore == opposingScore){
winOrLoss = "Unknown"; //TODO figure something out with this
}
globals.gamesDB.document(widget.gameID).updateData({
"WinOrLoss":winOrLoss
});
Navigator.pop(context);
},
),
],
),
],
),
],
)
);
},
),
),
],
) : Container(
child: Padding(
padding: EdgeInsets.only(top: 8.0),
),
),
],
),
);
}
}
| 0 |
mirrored_repositories/MySoftballTeam/lib/screens | mirrored_repositories/MySoftballTeam/lib/screens/SeasonSchedule/edit_game.dart | import 'package:datetime_picker_formfield/datetime_picker_formfield.dart';
import 'package:datetime_picker_formfield/time_picker_formfield.dart';
import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:groovin_widgets/outline_dropdown_button.dart';
import 'package:intl/intl.dart';
import 'package:my_softball_team/globals.dart' as globals;
import 'package:outline_material_icons/outline_material_icons.dart';
class EditGame extends StatefulWidget {
@override
_EditGameState createState() => _EditGameState();
}
class _EditGameState extends State<EditGame> {
List<DropdownMenuItem> _homeOrAwayOptions = [
DropdownMenuItem(child: Text("Home"), value: "Home"),
DropdownMenuItem(child: Text("Away"), value: "Away"),
DropdownMenuItem(child: Text("Bye"), value: "Bye")
];
TextEditingController _editGameDateController = TextEditingController();
TextEditingController _editGameTimeController = TextEditingController();
TextEditingController _editGameLocationController = TextEditingController();
TextEditingController _editOpposingTeamController = TextEditingController();
String year;
String month;
DateTime gameDate;
TimeOfDay gameTime;
String _homeOrAway;
DocumentSnapshot gameToUpdate;
final dateFormat = DateFormat("MMMM d, yyyy");
final timeFormat = DateFormat("h:mm a");
void _chooseHomeOrAway(value) {
setState(() {
_homeOrAway = value;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 0.0,
backgroundColor: Theme.of(context).canvasColor,
centerTitle: true,
title: Text(
"Edit Game",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
iconTheme: IconThemeData(color: Colors.black),
),
body: StreamBuilder<QuerySnapshot>(
stream: globals.gamesDB.snapshots(),
builder: (context, snapshot){
if(snapshot.hasData == true){
List<DocumentSnapshot> games = snapshot.data.documents;
for(int index = 0; index < games.length; index++) {
if(games[index].documentID == globals.selectedGameDocument){
gameToUpdate = games[index];
return SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(bottom: 16.0),
child: DateTimePickerFormField(
dateOnly: true,
format: dateFormat,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: "${gameToUpdate['GameDate']}",
prefixIcon: Icon(OMIcons.today),
),
controller: _editGameDateController,
editable: false,
),
),
Padding(
padding: const EdgeInsets.only(bottom: 16.0),
child: TimePickerFormField(
format: timeFormat,
editable: false,
controller: _editGameTimeController,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: "${gameToUpdate['GameTime']}",
prefixIcon: Icon(OMIcons.accessTime),
),
),
),
Padding(
padding: const EdgeInsets.only(bottom: 16.0),
child: TextField(
controller: _editOpposingTeamController,
decoration: InputDecoration(
prefixIcon: Icon(OMIcons.group),
labelText: "Opposing Team: " + "${gameToUpdate['OpposingTeam']}",
border: OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(Icons.clear),
onPressed: (){
_editOpposingTeamController.text = "";
}
),
),
),
),
Padding(
padding: const EdgeInsets.only(bottom: 16.0),
child: TextField(
controller: _editGameLocationController,
decoration: InputDecoration(
labelText: "Game Location: " + "${gameToUpdate['GameLocation']}",
prefixIcon: Icon(OMIcons.locationOn),
border: OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(Icons.clear),
onPressed: (){
_editGameLocationController.text = "";
})
),
),
),
Padding(
padding: const EdgeInsets.only(bottom: 16.0),
child: OutlineDropdownButton(
items: _homeOrAwayOptions,
onChanged: _chooseHomeOrAway,
hint: Row(
children: <Widget>[
Icon(OMIcons.notListedLocation, color: Colors.grey[600],),
Padding(
padding: const EdgeInsets.only(left: 10.0),
child: Text("${gameToUpdate['HomeOrAway']}"),
),
],
),
value: _homeOrAway,
),
),
],
),
),
],
),
),
);
}
}
} else {
return CircularProgressIndicator();
}
},
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
floatingActionButton: FloatingActionButton.extended(
label: Text("Update"),
icon: Icon(OMIcons.update),
onPressed: () {
if(_editGameDateController.text == "" || _editGameDateController.text == null){
_editGameDateController.text = "${gameToUpdate['GameDate']}";
}
if(_editGameTimeController.text == "" || _editGameTimeController.text == null){
_editGameTimeController.text = "${gameToUpdate['GameTime']}";
}
if(_editOpposingTeamController.text == "" || _editOpposingTeamController.text == null){
_editOpposingTeamController.text = "${gameToUpdate['OpposingTeam']}";
}
if(_editGameLocationController.text == "" || _editGameLocationController.text == null){
_editGameLocationController.text = "${gameToUpdate['GameLocation']}";
}
if(_homeOrAway == "" || _homeOrAway == null){
_homeOrAway = "${gameToUpdate['HomeOrAway']}";
}
// TODO: Record win/loss in a Record document
globals.gamesDB.document(globals.selectedGameDocument).updateData(
{
"GameDate":_editGameDateController.text,
"GameTime":_editGameTimeController.text,
"OpposingTeam":_editOpposingTeamController.text,
"GameLocation":_editGameLocationController.text,
"HomeOrAway":_homeOrAway,
}
);
Navigator.pop(context);
},
),
);
}
}
| 0 |
mirrored_repositories/MySoftballTeam/lib/screens | mirrored_repositories/MySoftballTeam/lib/screens/SeasonSchedule/season_schedule.dart | import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart' ;
import 'package:my_softball_team/globals.dart' as globals;
import 'package:my_softball_team/screens/SeasonSchedule/edit_game.dart';
import 'package:groovin_material_icons/groovin_material_icons.dart';
import 'package:my_softball_team/screens/SeasonSchedule/game_card.dart';
class SeasonSchedule extends StatefulWidget {
@override
_SeasonScheduleState createState() => _SeasonScheduleState();
}
class _SeasonScheduleState extends State<SeasonSchedule> {
@override
Widget build(BuildContext context) {
return StreamBuilder<QuerySnapshot>(
stream: Firestore.instance.collection("Teams")
.document(globals.teamName)
.collection("Seasons")
.document(DateTime.now().year.toString())
.collection("Games")
.snapshots(),
builder: (context, snapshot) {
List<Widget> gameCards = [];
if(snapshot.hasData) {
List<DocumentSnapshot> games = snapshot.data.documents;
games.sort((a, b){
DateTime game1 = globals.convertStringDateToDateTime(a['GameDate'], a['GameTime']);
DateTime game2 = globals.convertStringDateToDateTime(b['GameDate'], b['GameTime']);
return game1.compareTo(game2);
});
for(int index = 0; index < games.length; index++) {
// Check each game date - if the date is in the past, do not display a GameCard
DateTime gameDate = globals.convertStringDateToDateTime(
"${games[index]['GameDate']}",
"${games[index]['GameTime']}",
);
DateTime today = new DateTime(
DateTime.now().year,
DateTime.now().month,
DateTime.now().day,
0
);
//print(dateToEval);
if(gameDate.isBefore(today) == true){
// do not create a GameCard
} else {
gameCards.add(
Padding(
padding: const EdgeInsets.only(left: 8.0, right: 8.0, bottom: 8.0),
child: GameCard(
gameID: games[index].documentID,
homeOrAway: "${games[index]['HomeOrAway']}",
teamName: globals.teamName,
opposingTeam: "${games[index]['OpposingTeam']}",
gameTime: "${games[index]['GameTime']}",
gameDate: "${games[index]['GameDate']}",
gameLocation: "${games[index]['GameLocation']}",
isPreviousGame: false,
),
),
);
}
}
return gameCards.length > 0 ? ListView.builder(
itemCount: gameCards.length,
itemBuilder: (context, index){
return gameCards[index];
},
) :
Center(
child: Padding(
padding: const EdgeInsets.only(bottom: 50.0),
child: Text("No games scheduled"),
),
);
} else {
return Center(child: Text("Data not found"));
}
},
);
}
}
| 0 |
mirrored_repositories/MySoftballTeam/lib/screens | mirrored_repositories/MySoftballTeam/lib/screens/SeasonSchedule/add_new_game.dart | import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:groovin_material_icons/groovin_material_icons.dart';
import 'package:intl/intl.dart';
import 'package:my_softball_team/globals.dart' as globals;
import 'package:datetime_picker_formfield/datetime_picker_formfield.dart';
import 'package:datetime_picker_formfield/time_picker_formfield.dart';
import 'package:outline_material_icons/outline_material_icons.dart';
import 'package:groovin_widgets/groovin_widgets.dart';
class AddNewGame extends StatefulWidget{
@override
_AddNewGameState createState() => _AddNewGameState();
}
class _AddNewGameState extends State<AddNewGame> {
List<DropdownMenuItem> _homeOrAwayOptions = [
DropdownMenuItem(child: Text("Home"), value: "Home",),
DropdownMenuItem(child: Text("Away"), value: "Away",),
DropdownMenuItem(child: Text("Bye"), value: "Bye",)
];
final dateFormat = DateFormat("MMMM d, yyyy");
final timeFormat = DateFormat("h:mm a");
TextEditingController _opposingTeamController = TextEditingController();
TextEditingController _gameLocationController = TextEditingController();
TextEditingController _gameDateController = TextEditingController();
TextEditingController _gameTimeController = TextEditingController();
String year;
String month;
DateTime gameDate;
TimeOfDay gameTime;
String _homeOrAway;
void _chooseHomeOrAway(value) {
setState(() {
_homeOrAway = value;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 0.0,
centerTitle: true,
backgroundColor: Theme.of(context).canvasColor,
title: Text(
"Add New Game",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
iconTheme: IconThemeData(color: Colors.black),
),
body: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 16.0, right: 16.0, top: 25.0),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(bottom: 16.0),
child: DateTimePickerFormField(
dateOnly: true,
format: dateFormat,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: "Game Date",
prefixIcon: Icon(OMIcons.today),
),
controller: _gameDateController,
editable: false,
),
),
Padding(
padding: const EdgeInsets.only(bottom: 16.0),
child: TimePickerFormField(
format: timeFormat,
editable: false,
controller: _gameTimeController,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: "Game Time",
prefixIcon: Icon(OMIcons.accessTime),
),
),
),
Padding(
padding: const EdgeInsets.only(bottom: 16.0),
child: TextField(
controller: _opposingTeamController,
decoration: InputDecoration(
labelText: "Opposing Team*",
prefixIcon: Icon(OMIcons.group),
border: OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(Icons.clear),
onPressed: (){
_opposingTeamController.text = "";
}
),
),
),
),
TextField(
controller: _gameLocationController,
decoration: InputDecoration(
labelText: "Game Location*",
prefixIcon: Icon(OMIcons.locationOn),
border: OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(Icons.clear),
onPressed: (){
_gameLocationController.text = "";
})
),
),
],
),
SizedBox(height: 15.0),
OutlineDropdownButton(
items: _homeOrAwayOptions,
onChanged: _chooseHomeOrAway,
hint: Row(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 4.0),
child: Icon(OMIcons.notListedLocation, color: Colors.grey[600],),
),
Padding(
padding: const EdgeInsets.only(left: 12.0),
child: Text("Home or Away"),
),
],
),
value: _homeOrAway,
),
SizedBox(height: 25.0),
],
),
),
),
],
),
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
floatingActionButton: FloatingActionButton.extended(
icon: Icon(Icons.save),
label: Text("Save"),
onPressed: () {
if(_gameDateController.text != "" && _gameTimeController.text != "") {
if(_opposingTeamController.text != "" && _gameLocationController.text != "") {
globals.gamesDB.add({
"GameDate":_gameDateController.text,
"GameTime":_gameTimeController.text,
"OpposingTeam":_opposingTeamController.text,
"GameLocation":_gameLocationController.text,
"HomeOrAway":_homeOrAway
});
Navigator.pop(context);
}
}
},
),
);
}
}
| 0 |
mirrored_repositories/MySoftballTeam/lib/screens | mirrored_repositories/MySoftballTeam/lib/screens/Player/edit_stats.dart | import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:async/async.dart';
import 'package:groovin_material_icons/groovin_material_icons.dart';
import 'package:my_softball_team/globals.dart' as globals;
class EditStats extends StatefulWidget {
@override
_EditStatsState createState() => _EditStatsState();
}
class _EditStatsState extends State<EditStats> {
// Controllers
TextEditingController _atBatsController = TextEditingController();
TextEditingController _singlesController = TextEditingController();
TextEditingController _doublesController = TextEditingController();
TextEditingController _triplesController = TextEditingController();
TextEditingController _homeRunsController = TextEditingController();
TextEditingController _runsBattedInController = TextEditingController();
TextEditingController _walksController = TextEditingController();
TextEditingController _strikeoutsController = TextEditingController();
TextEditingController _gamesPlayerController = TextEditingController();
TextEditingController _outsReceivedController = TextEditingController();
TextEditingController _outsFieldedController = TextEditingController();
// Variables
String atBats;
String singles;
String doubles;
String triples;
String homeRuns;
String runsBattedIn;
String walks;
String strikeouts;
String gamesPlayed;
String outsReceived;
String outsFielded;
CollectionReference playersCollection = Firestore.instance.collection("Teams").document(globals.teamName).collection("Players");
DocumentSnapshot player;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 0.0,
backgroundColor: Theme.of(context).canvasColor,
centerTitle: true,
title: Text(
"Update Stats",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
iconTheme: IconThemeData(color: Colors.black),
),
body: StreamBuilder<QuerySnapshot>(
stream: playersCollection.snapshots(),
builder: (context, snapshot){
if(snapshot.hasData == true) {
List<DocumentSnapshot> players = snapshot.data.documents;
for(int index = 0; index < players.length; index++){
if(players[index].documentID == globals.selectedPlayerName){
player = players[index];
}
}
atBats = "${player['AtBats']}";
singles = "${player['Singles']}";
doubles = "${player['Doubles']}";
triples = "${player['Triples']}";
homeRuns = "${player['HomeRuns']}";
runsBattedIn = "${player['RunsBattedIn']}";
walks = "${player['Walks']}";
strikeouts = "${player['Strikeouts']}";
gamesPlayed = "${player['GamesPlayed']}";
outsReceived = "${player['OutsReceived']}";
outsFielded = "${player['OutsFielded']}";
return SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(
keyboardType: TextInputType.number,
decoration: InputDecoration(
labelText: "Current At Bats: ${player['AtBats']}",
/*filled: true,
fillColor: Colors.black12,*/
border: OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(Icons.clear),
onPressed: (){
_atBatsController.text="";
},
)
),
controller: _atBatsController,
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(
keyboardType: TextInputType.number,
decoration: InputDecoration(
labelText: "Current Singles: ${player['Singles']}",
/*filled: true,
fillColor: Colors.black12,*/
border: OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(Icons.clear),
onPressed: (){
_singlesController.text="";
},
)
),
controller: _singlesController,
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(
keyboardType: TextInputType.number,
decoration: InputDecoration(
labelText: "Current Doubles: ${player['Doubles']}",
/*filled: true,
fillColor: Colors.black12,*/
border: OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(Icons.clear),
onPressed: (){
_doublesController.text="";
},
)
),
controller: _doublesController,
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(
keyboardType: TextInputType.number,
decoration: InputDecoration(
labelText: "Current Triples: ${player['Triples']}",
/*filled: true,
fillColor: Colors.black12,*/
border: OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(Icons.clear),
onPressed: (){
_triplesController.text="";
},
)
),
controller: _triplesController,
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(
keyboardType: TextInputType.number,
decoration: InputDecoration(
labelText: "Current Home Runs: ${player['HomeRuns']}",
/*filled: true,
fillColor: Colors.black12,*/
border: OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(Icons.clear),
onPressed: (){
_homeRunsController.text="";
},
)
),
controller: _homeRunsController,
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(
keyboardType: TextInputType.number,
decoration: InputDecoration(
labelText: "Current RBIs: ${player['RunsBattedIn']}",
/*filled: true,
fillColor: Colors.black12,*/
border: OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(Icons.clear),
onPressed: (){
_runsBattedInController.text="";
},
)
),
controller: _runsBattedInController,
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(
keyboardType: TextInputType.number,
decoration: InputDecoration(
labelText: "Current Walks: ${player['Walks']}",
/*filled: true,
fillColor: Colors.black12,*/
border: OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(Icons.clear),
onPressed: (){
_walksController.text="";
},
)
),
controller: _walksController,
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(
keyboardType: TextInputType.number,
decoration: InputDecoration(
labelText: "Current Strikeouts: ${player['Strikeouts']}",
/*filled: true,
fillColor: Colors.black12,*/
border: OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(Icons.clear),
onPressed: (){
_strikeoutsController.text="";
},
)
),
controller: _strikeoutsController,
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(
keyboardType: TextInputType.number,
decoration: InputDecoration(
labelText: "Current Games Played: " + gamesPlayed,
/*filled: true,
fillColor: Colors.black12,*/
border: OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(Icons.clear),
onPressed: (){
_gamesPlayerController.text="";
},
)
),
controller: _gamesPlayerController,
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(
keyboardType: TextInputType.number,
decoration: InputDecoration(
labelText: "Current Outs Fielded: ${player['OutsFielded']}",
/*filled: true,
fillColor: Colors.black12,*/
border: OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(Icons.clear),
onPressed: (){
_outsFieldedController.text="";
},
)
),
controller: _outsFieldedController,
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(
keyboardType: TextInputType.number,
decoration: InputDecoration(
labelText: "Current Outs Received: ${player['OutsReceived']}",
/*filled: true,
fillColor: Colors.black12,*/
border: OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(Icons.clear),
onPressed: (){
_outsReceivedController.text="";
},
)
),
controller: _outsReceivedController,
),
),
],
),
),
],
),
);
} else {
return Center(
child: CircularProgressIndicator(),
);
}
},
),
floatingActionButton: FloatingActionButton.extended(
label: Text("Update stats"),
icon: Icon(GroovinMaterialIcons.update),
onPressed: () {
if(atBats == "" || atBats == null){
atBats = "0";
} else if(_atBatsController.text.length > 0) {
atBats= _atBatsController.text;
}
if(singles == "" || singles == null){
singles = "0";
} else if(_singlesController.text.length > 0) {
singles = _singlesController.text;
}
if(doubles == "" || doubles == null){
doubles = "0";
} else if(_doublesController.text.length > 0) {
doubles = _doublesController.text;
}
if(triples == "" || triples == null){
triples = "0";
} else if(_triplesController.text.length > 0) {
triples = _triplesController.text;
}
if(homeRuns == "" || homeRuns == null){
homeRuns = "0";
} else if(_homeRunsController.text.length > 0) {
homeRuns = _homeRunsController.text;
}
if(runsBattedIn == "" || runsBattedIn == null){
runsBattedIn = "0";
} else if(_runsBattedInController.text.length > 0) {
runsBattedIn = _runsBattedInController.text;
}
if(walks == "" || walks == null){
walks = "0";
} else if(_walksController.text.length > 0) {
walks = _walksController.text;
}
if(strikeouts == "" || strikeouts == null){
strikeouts = "0";
} else if(_strikeoutsController.text.length > 0) {
strikeouts = _strikeoutsController.text;
}
if(gamesPlayed == "" || gamesPlayed == null){
gamesPlayed = "0";
} else if(_gamesPlayerController.text.length > 0) {
gamesPlayed = _gamesPlayerController.text;
}
if(outsReceived == "" || outsReceived == null){
outsReceived = "0";
} else if(_outsReceivedController.text.length > 0) {
outsReceived = _outsReceivedController.text;
}
if(outsFielded == "" || outsFielded == null){
outsFielded = "0";
} else if(_outsFieldedController.text.length > 0) {
outsFielded = _outsFieldedController.text;
}
playersCollection.document(globals.selectedPlayerName).updateData({
"AtBats" : atBats,
"Singles" : singles,
"Doubles" : doubles,
"Triples" : triples,
"HomeRuns" : homeRuns,
"RunsBattedIn" : runsBattedIn,
"Walks" : walks,
"Strikeouts" : strikeouts,
"GamesPlayed" : gamesPlayed,
"OutsReceived" : outsReceived,
"OutsFielded" : outsFielded
});
Navigator.pop(context);
},
),
);
}
}
| 0 |
mirrored_repositories/MySoftballTeam/lib/screens | mirrored_repositories/MySoftballTeam/lib/screens/Player/add_new_player.dart | import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:groovin_material_icons/groovin_material_icons.dart';
import 'package:groovin_widgets/groovin_widgets.dart';
import 'package:groovin_widgets/outline_dropdown_button.dart';
import 'package:my_softball_team/globals.dart' as globals;
import 'package:outline_material_icons/outline_material_icons.dart';
class AddNewPlayer extends StatefulWidget {
@override
_AddNewPlayerState createState() => _AddNewPlayerState();
}
class _AddNewPlayerState extends State<AddNewPlayer> {
// Controllers
TextEditingController _playerNameController = TextEditingController();
TextEditingController _atBatsController = TextEditingController();
TextEditingController _singlesController = TextEditingController();
TextEditingController _doublesController = TextEditingController();
TextEditingController _triplesController = TextEditingController();
TextEditingController _homeRunsController = TextEditingController();
TextEditingController _runsBattedInController = TextEditingController();
TextEditingController _walksController = TextEditingController();
TextEditingController _strikeoutsController = TextEditingController();
TextEditingController _gamesPlayerController = TextEditingController();
TextEditingController _outsReceivedController = TextEditingController();
TextEditingController _outsFieldedController = TextEditingController();
// Variables
String playerName;
String position;
String atBats;
String singles;
String doubles;
String triples;
String homeRuns;
String runsBattedIn;
String walks;
String strikeouts;
String gamesPlayed;
String outsReceived;
String outsFielded;
// Set field position on DropdownButton tap
void _chooseFieldPosition(value) {
setState(() {
position = value;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
"Add New Player",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
backgroundColor: Theme.of(context).canvasColor,
iconTheme: IconThemeData(color: Colors.black),
elevation: 0.0,
centerTitle: true,
),
body: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
TextField(
decoration: InputDecoration(
labelText: "Player Name",
prefixIcon: Icon(OMIcons.person),
border: OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(Icons.clear),
onPressed: () {
_playerNameController.text = "";
},
),
),
textCapitalization: TextCapitalization.words,
controller: _playerNameController,
),
SizedBox(
height: 25.0,
),
OutlineDropdownButton(
items: globals.fieldPositions,
onChanged: _chooseFieldPosition,
hint: Row(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 4.0),
child: Icon(
Icons.not_listed_location,
color: Colors.grey,
),
),
Padding(
padding: const EdgeInsets.only(left: 10.0),
child: Text("Choose Field Position"),
),
],
),
value: position,
),
SizedBox(
height: 15.0,
),
GroovinExpansionTile(
title: Text("Initial Stats (Optional)"),
children: <Widget>[
SizedBox(
width: double.infinity,
child: TextField(
keyboardType: TextInputType.number,
controller: _atBatsController,
decoration: InputDecoration(
labelText: "At Bats",
/*filled: true,
fillColor: Colors.black12,*/
border: OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(Icons.clear),
onPressed: () {
_atBatsController.text = "";
}),
),
),
),
SizedBox(
height: 15.0,
),
SizedBox(
width: double.infinity,
child: TextField(
keyboardType: TextInputType.number,
controller: _singlesController,
decoration: InputDecoration(
labelText: "Singles",
/*filled: true,
fillColor: Colors.black12,*/
border: OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(Icons.clear),
onPressed: () {
_singlesController.text = "";
}),
),
),
),
SizedBox(
height: 15.0,
),
SizedBox(
width: double.infinity,
child: TextField(
keyboardType: TextInputType.number,
controller: _doublesController,
decoration: InputDecoration(
labelText: "Doubles",
/*filled: true,
fillColor: Colors.black12,*/
border: OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(Icons.clear),
onPressed: () {
_doublesController.text = "";
}),
),
),
),
SizedBox(
height: 15.0,
),
SizedBox(
width: double.infinity,
child: TextField(
keyboardType: TextInputType.number,
controller: _triplesController,
decoration: InputDecoration(
labelText: "Triples",
/*filled: true,
fillColor: Colors.black12,*/
border: OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(Icons.clear),
onPressed: () {
_triplesController.text = "";
}),
),
),
),
SizedBox(
height: 15.0,
),
SizedBox(
width: double.infinity,
child: TextField(
keyboardType: TextInputType.number,
controller: _homeRunsController,
decoration: InputDecoration(
labelText: "Home Runs",
/*filled: true,
fillColor: Colors.black12,*/
border: OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(Icons.clear),
onPressed: () {
_homeRunsController.text = "";
}),
),
),
),
SizedBox(
height: 15.0,
),
SizedBox(
width: double.infinity,
child: TextField(
keyboardType: TextInputType.number,
controller: _runsBattedInController,
decoration: InputDecoration(
labelText: "Runs Batted In",
/*filled: true,
fillColor: Colors.black12,*/
border: OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(Icons.clear),
onPressed: () {
_runsBattedInController.text = "";
}),
),
),
),
SizedBox(
height: 15.0,
),
SizedBox(
width: double.infinity,
child: TextField(
keyboardType: TextInputType.number,
controller: _walksController,
decoration: InputDecoration(
labelText: "Walks",
/*filled: true,
fillColor: Colors.black12,*/
border: OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(Icons.clear),
onPressed: () {
_walksController.text = "";
}),
),
),
),
SizedBox(
height: 15.0,
),
SizedBox(
width: double.infinity,
child: TextField(
keyboardType: TextInputType.number,
controller: _strikeoutsController,
decoration: InputDecoration(
labelText: "Strikeouts",
/*filled: true,
fillColor: Colors.black12,*/
border: OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(Icons.clear),
onPressed: () {
_strikeoutsController.text = "";
}),
),
),
),
SizedBox(
height: 15.0,
),
SizedBox(
width: double.infinity,
child: TextField(
keyboardType: TextInputType.number,
controller: _gamesPlayerController,
decoration: InputDecoration(
labelText: "Games Played",
/*filled: true,
fillColor: Colors.black12,*/
border: OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(Icons.clear),
onPressed: () {
_gamesPlayerController.text = "";
}),
),
),
),
SizedBox(
height: 15.0,
),
SizedBox(
width: double.infinity,
child: TextField(
keyboardType: TextInputType.number,
controller: _outsReceivedController,
decoration: InputDecoration(
labelText: "Outs Received",
/*filled: true,
fillColor: Colors.black12,*/
border: OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(Icons.clear),
onPressed: () {
_outsReceivedController.text = "";
}),
),
),
),
SizedBox(
height: 15.0,
),
SizedBox(
width: double.infinity,
child: TextField(
keyboardType: TextInputType.number,
controller: _outsFieldedController,
decoration: InputDecoration(
labelText: "Outs Fielded",
/*filled: true,
fillColor: Colors.black12,*/
border: OutlineInputBorder(),
suffixIcon: IconButton(
icon: Icon(Icons.clear),
onPressed: () {
_outsFieldedController.text = "";
}),
),
),
),
SizedBox(
height: 25.0,
),
],
),
],
),
),
],
),
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
floatingActionButton: FloatingActionButton.extended(
label: Text("Save"),
icon: Icon(Icons.save),
onPressed: () => Firestore.instance.runTransaction((transaction) async {
playerName = _playerNameController.text;
atBats = _atBatsController.text;
singles = _singlesController.text;
doubles = _doublesController.text;
triples = _triplesController.text;
homeRuns = _homeRunsController.text;
runsBattedIn = _runsBattedInController.text;
gamesPlayed = _gamesPlayerController.text;
outsReceived = _outsReceivedController.text;
outsFielded = _outsFieldedController.text;
if (atBats == "" || atBats == null) {
atBats = "0";
}
if (singles == "" || singles == null) {
singles = "0";
}
if (doubles == "" || doubles == null) {
doubles = "0";
}
if (triples == "" || triples == null) {
triples = "0";
}
if (homeRuns == "" || homeRuns == null) {
homeRuns = "0";
}
if (runsBattedIn == "" || runsBattedIn == null) {
runsBattedIn = "0";
}
if (walks == "" || walks == null) {
walks = "0";
}
if (strikeouts == "" || strikeouts == null) {
strikeouts = "0";
}
if (gamesPlayed == "" || gamesPlayed == null) {
gamesPlayed = "0";
}
if (outsReceived == "" || outsReceived == null) {
outsReceived = "0";
}
if (outsFielded == "" || outsFielded == null) {
outsFielded = "0";
}
// Save the player to the database
CollectionReference team = Firestore.instance
.collection('Teams')
.document(globals.teamName)
.collection("Players");
team.document(playerName).setData({
"PlayerName": playerName,
"FieldPosition": position,
"AtBats": atBats,
"Singles": singles,
"Doubles": doubles,
"Triples": triples,
"HomeRuns": homeRuns,
"RunsBattedIn": runsBattedIn,
"Walks": walks,
"Strikeouts": strikeouts,
"GamesPlayed": gamesPlayed,
"OutsReceived": outsReceived,
"OutsFielded": outsFielded
});
Navigator.pop(context);
}),
),
);
}
}
| 0 |
mirrored_repositories/MySoftballTeam/lib/screens | mirrored_repositories/MySoftballTeam/lib/screens/EmailList/email_card.dart | import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:outline_material_icons/outline_material_icons.dart';
import 'package:my_softball_team/globals.dart' as globals;
class EmailCard extends StatefulWidget {
final DocumentSnapshot emailSnap;
const EmailCard({
this.emailSnap,
});
@override
_EmailCardState createState() => _EmailCardState();
}
class _EmailCardState extends State<EmailCard> {
TextEditingController _editEmailAddressFieldContoller = TextEditingController();
@override
Widget build(BuildContext context) {
return Card(
elevation: 2.0,
child: ListTile(
leading: Icon(OMIcons.email),
title: Text(widget.emailSnap.documentID),
trailing: SizedBox(
width: 100.0,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
IconButton(
icon: Icon(OMIcons.edit, color: Colors.black,),
onPressed: (){
String selectedEmail = widget.emailSnap.documentID;
showDialog(
context: context,
builder: (_) => SimpleDialog(
title: Text("Edit Email Address"),
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: ListTile(
title: TextField(
controller: _editEmailAddressFieldContoller,
keyboardType: TextInputType.emailAddress,
decoration: InputDecoration(
labelText: selectedEmail,
prefixIcon: Icon(OMIcons.email),
border: OutlineInputBorder(),
),
),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Padding(padding: EdgeInsets.only(right: 16.0),
child: FlatButton(
child: Text("Save", style: TextStyle(color: Colors.indigo),),
onPressed: (){
String updatedEmail = _editEmailAddressFieldContoller.text;
CollectionReference addressBook = Firestore.instance.collection("Teams").document(globals.teamName).collection("EmailList");
addressBook.document(widget.emailSnap.documentID).delete();
addressBook.document(updatedEmail).setData({});
_editEmailAddressFieldContoller.text = "";
Navigator.pop(context);
},
),
)
],
),
],
),
);
},
),
IconButton(
icon: Icon(OMIcons.delete, color: Colors.black,),
onPressed: (){
CollectionReference addressBook = Firestore.instance.collection("Teams").document(globals.teamName).collection("EmailList");
addressBook.document(widget.emailSnap.documentID).delete();
},
),
],
),
),
),
);
}
}
| 0 |
mirrored_repositories/MySoftballTeam/lib/screens | mirrored_repositories/MySoftballTeam/lib/screens/EmailList/email_list.dart | import 'package:groovin_material_icons/groovin_material_icons.dart';
import 'package:flutter/material.dart';
import 'package:my_softball_team/screens/EmailList/email_card.dart';
import 'package:outline_material_icons/outline_material_icons.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:my_softball_team/globals.dart' as globals;
class EmailList extends StatefulWidget {
@override
_EmailListState createState() => _EmailListState();
}
class _EmailListState extends State<EmailList> {
List<Widget> emailFields = [];
TextEditingController _emailAddressFieldContoller = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).canvasColor,
iconTheme: IconThemeData(color: Colors.black),
elevation: 0.0,
centerTitle: true,
title: Text(
"Email List",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
),
body: StreamBuilder<QuerySnapshot>(
stream: Firestore.instance.collection("Teams").document(globals.teamName).collection("EmailList").snapshots(),
builder: (context, snapshot){
if(snapshot.hasData == false){
return Container();
} else {
return ListView.builder(
itemCount: snapshot.data.documents.length,
itemBuilder: (context, index){
DocumentSnapshot ds = snapshot.data.documents[index];
return EmailCard(
emailSnap: ds,
);
}
);
}
},
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
floatingActionButton: FloatingActionButton.extended(
icon: Icon(Icons.add),
label: Text("Add Email"),
onPressed: (){
showDialog(
context: context,
builder: (_) => SimpleDialog(
title: Text("Add email"),
children: <Widget>[
Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
color: Colors.white,
child: Column(
children: <Widget>[
ListTile(
title: TextField(
controller: _emailAddressFieldContoller,
keyboardType: TextInputType.emailAddress,
decoration: InputDecoration(
labelText: "Email Address",
border: OutlineInputBorder(),
prefixIcon: Icon(OMIcons.email),
),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(right: 16.0),
child: FlatButton(
child: Text("Save", style: TextStyle(color: Colors.indigo),),
onPressed: (){
String emailAddress = _emailAddressFieldContoller.text;
CollectionReference addressBook = Firestore.instance.collection("Teams").document(globals.teamName).collection("EmailList");
addressBook.document(emailAddress).setData({});
_emailAddressFieldContoller.text = "";
Navigator.pop(context);
},
),
),
],
),
],
),
)
],
),
],
),
);
},
),
);
}
}
| 0 |
mirrored_repositories/MySoftballTeam/lib/screens | mirrored_repositories/MySoftballTeam/lib/screens/TeamList/player_card.dart | import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:groovin_widgets/groovin_widgets.dart';
import 'package:my_softball_team/globals.dart' as globals;
import 'package:my_softball_team/screens/Player/edit_stats.dart';
import 'package:outline_material_icons/outline_material_icons.dart';
class PlayerCard extends StatefulWidget {
final DocumentSnapshot playerSnap;
const PlayerCard({
this.playerSnap,
});
@override
_PlayerCardState createState() => _PlayerCardState();
}
class _PlayerCardState extends State<PlayerCard> {
CollectionReference teamCollection = Firestore.instance
.collection("Teams")
.document(globals.teamName)
.collection("Players");
var position;
// Set field position on DropdownButton tap
void _changeFieldPosition(value) {
setState(() {
position = value;
teamCollection
.document(globals.selectedPlayerName)
.updateData({"FieldPosition": position});
//Navigator.pop(context);
});
}
@override
Widget build(BuildContext context) {
return Card(
elevation: 2.0,
child: ListTile(
leading: CircleAvatar(
child: Text(
"${widget.playerSnap['PlayerName']}"[0],
style: TextStyle(color: Colors.white),
),
backgroundColor: Theme.of(context).accentColor,
),
title: Text(
"${widget.playerSnap['PlayerName']}",
style: TextStyle(fontWeight: FontWeight.bold),
),
subtitle: Text("${widget.playerSnap['FieldPosition']}"),
trailing: SizedBox(
width: 150.0,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
IconButton(
icon: Icon(
OMIcons.assessment,
color: Colors.black,
),
onPressed: () {
globals.selectedPlayerName = "${widget.playerSnap['PlayerName']}";
Navigator.of(context).push(MaterialPageRoute<Null>(
builder: (BuildContext context) {
return EditStats();
},
fullscreenDialog: true),
);
},
),
IconButton(
icon: Icon(
OMIcons.locationOn,
color: Colors.black,
),
onPressed: () {
globals.selectedPlayerName = "${widget.playerSnap['PlayerName']}";
showDialog(
context: context,
builder: (_) => SimpleDialog(
title: Container(
decoration: BoxDecoration(
color: Theme.of(context).accentColor,
borderRadius: BorderRadius.only(
topRight: Radius.circular(3.0),
topLeft: Radius.circular(3.0),
),
),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Container(
alignment: Alignment.center,
child: Text(
"Change Field Position",
style: TextStyle(
color: Colors.white,
),
),
),
),
),
titlePadding: EdgeInsets.all(0.0),
contentPadding: EdgeInsets.only(
top: 16.0,
right: 16.0,
left: 16.0,
),
children: <Widget>[
Column(
children: <Widget>[
OutlineDropdownButton(
items: globals.fieldPositions,
onChanged: _changeFieldPosition,
hint: Text("${widget.playerSnap['FieldPosition']}"),
value: position,
),
Container(
alignment: Alignment.centerRight,
child: RaisedButton(
color: Theme.of(context).accentColor,
child: Text(
"Ok",
style: TextStyle(
color: Colors.white,
),
),
onPressed: () {
Navigator.pop(context);
},
),
),
],
)
],
),
);
},
),
IconButton(
icon: Icon(
Icons.delete_outline,
color: Colors.black,
),
onPressed: () => Firestore.instance.runTransaction(
(transaction) async {
globals.selectedPlayerName = "${widget.playerSnap['PlayerName']}";
showDialog(
context: context,
builder: (_) => AlertDialog(
title: Text(
"Remove ${widget.playerSnap['PlayerName']} from your team?"),
actions: <Widget>[
FlatButton(
onPressed: () {
Navigator.pop(context);
},
child: Text("No"),
),
FlatButton(
onPressed: () {
// Delete player from database
teamCollection
.document(globals.selectedPlayerName)
.delete();
Navigator.pop(context);
},
child: Text("Yes"),
),
],
),
);
},
),
),
],
),
),
),
);
}
}
| 0 |
mirrored_repositories/MySoftballTeam/lib/screens | mirrored_repositories/MySoftballTeam/lib/screens/TeamList/team_list.dart | import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart' ;
import 'package:my_softball_team/globals.dart' as globals;
import 'package:my_softball_team/screens/TeamList/player_card.dart';
class TeamList extends StatefulWidget {
@override
_TeamListState createState() => _TeamListState();
}
CollectionReference teamCollection = Firestore.instance.collection("Teams")
.document(globals.teamName)
.collection("Players");
class _TeamListState extends State<TeamList> {
@override
Widget build(BuildContext context) {
return StreamBuilder<QuerySnapshot>(
stream: teamCollection.snapshots(),
builder: (context, snapshot) {
if (snapshot.hasData == true) {
return ListView.builder(
itemCount: snapshot.data.documents.length,
itemBuilder: (context, index) {
DocumentSnapshot ds = snapshot.data.documents[index];
return Padding(
padding: const EdgeInsets.only(left: 8.0, right: 8.0),
child: PlayerCard(
playerSnap: ds,
),
);
});
} else {
return Center(
child: CircularProgressIndicator(),
);
}
},
);
}
}
| 0 |
mirrored_repositories/MySoftballTeam/lib/screens | mirrored_repositories/MySoftballTeam/lib/screens/StatsLeaderboard/leaderboard_header.dart | import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:my_softball_team/globals.dart' as globals;
import 'package:my_softball_team/widgets/GroovinDropdownButton.dart';
typedef LeaderboardHeaderChangeCallback = void Function(String);
class LeaderboardHeader extends StatefulWidget {
final String defaultSelection;
final LeaderboardHeaderChangeCallback onSelectionChange;
LeaderboardHeader({
@required this.defaultSelection,
@required this.onSelectionChange,
});
@override
_LeaderboardHeaderState createState() => _LeaderboardHeaderState();
}
class _LeaderboardHeaderState extends State<LeaderboardHeader> {
CollectionReference stats = Firestore.instance
.collection("Teams")
.document(globals.teamName)
.collection("Stats");
String statSelection;
@override
Widget build(BuildContext context) {
return Material(
elevation: 2.0,
borderRadius: BorderRadius.all(Radius.circular(10.0)),
color: Theme.of(context).accentColor,
child: Padding(
padding: const EdgeInsets.only(left: 16.0, right: 16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
"Rank",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
fontSize: 16.0,
),
),
Padding(
padding: const EdgeInsets.only(left: 56.0),
child: Text(
"Player",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
fontSize: 16.0,
),
),
),
Container(
width: MediaQuery.of(context).size.width / 4.5,
child: DropdownButtonHideUnderline(
child: StreamBuilder<QuerySnapshot>(
stream: stats.snapshots(),
builder: (context, snapshot) {
if(snapshot.hasError) {
print(snapshot.error);
}
if(!snapshot.hasData) {
return Center(
child: CircularProgressIndicator(),
);
} else {
final statListFromSnaps = snapshot;
final List<DropdownMenuItem> statList = [];
for(int i = 0; i < statListFromSnaps.data.documents.length; i++) {
DocumentSnapshot statSnap = statListFromSnaps.data.documents[i];
String value = statSnap.documentID.replaceAll(RegExp(r"\s+\b|\b\s"), "");
statList.add(
DropdownMenuItem(
child: Text(
statSnap.documentID,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 15.0
),
),
value: value,
),
);
}
statSelection = widget.defaultSelection;
return Theme(
data: ThemeData(
canvasColor: Colors.indigoAccent,
),
child: GroovinDropdownButton(
items: statList,
isExpanded: true,
iconColor: Colors.white,
hint: Text(
"Stat",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
color: Colors.white,
),
),
onChanged: (value) {
setState(() async{
statSelection = value;
await globals.usersDB.document(globals.loggedInUser.uid).updateData({
"StatTableSort":statSelection,
});
widget.onSelectionChange(statSelection);
});
},
value: statSelection,
),
);
}
},
),
),
),
],
),
),
);
}
} | 0 |
mirrored_repositories/MySoftballTeam/lib/screens | mirrored_repositories/MySoftballTeam/lib/screens/StatsLeaderboard/leaderboard_home.dart | import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:my_softball_team/globals.dart' as globals;
import 'package:my_softball_team/screens/StatsLeaderboard/leaderboard.dart';
import 'package:my_softball_team/screens/StatsLeaderboard/leaderboard_header.dart';
CollectionReference root = Firestore.instance.collection("Teams");
CollectionReference stats = Firestore.instance
.collection("Teams")
.document(globals.teamName)
.collection("Stats");
class LeaderboardHome extends StatefulWidget {
@override
_LeaderboardHomeState createState() => _LeaderboardHomeState();
}
class _LeaderboardHomeState extends State<LeaderboardHome> {
String statSort;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(left: 16.0, right: 16.0),
child: StreamBuilder<QuerySnapshot>(
stream: globals.usersDB.snapshots(),
builder: (context, snapshot) {
if(!snapshot.hasData) {
return Center(
child: CircularProgressIndicator(),
);
} else {
DocumentSnapshot user;
for(int i = 0; i < snapshot.data.documents.length; i++) {
if(snapshot.data.documents[i].documentID == globals.loggedInUser.uid) {
user = snapshot.data.documents[i];
}
}
statSort = user['StatTableSort'];
return Column(
children: <Widget>[
LeaderboardHeader(
defaultSelection: user['StatTableSort'],
onSelectionChange: (value) {
setState(() {
});
},
),
Expanded(
child: Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Leaderboard(
statSort: statSort,
),
),
),
],
);
}
},
),
);
}
} | 0 |
mirrored_repositories/MySoftballTeam/lib/screens | mirrored_repositories/MySoftballTeam/lib/screens/StatsLeaderboard/leaderboard.dart | import 'package:async/async.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:my_softball_team/globals.dart' as globals;
class Leaderboard extends StatefulWidget {
final String statSort;
const Leaderboard({
this.statSort,
});
@override
_LeaderboardState createState() => _LeaderboardState();
}
class _LeaderboardState extends State<Leaderboard> {
CollectionReference players = Firestore.instance
.collection("Teams")
.document(globals.teamName)
.collection("Players");
@override
Widget build(BuildContext context) {
return StreamBuilder<List<QuerySnapshot>>(
stream: StreamZip([
globals.usersDB.snapshots(),
players.orderBy(widget.statSort, descending: true).snapshots(),
]),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return Center(
child: CircularProgressIndicator(),
);
} else {
final userStream = snapshot.data[0];
final playerStream = snapshot.data[1];
DocumentSnapshot userDoc;
List<DocumentSnapshot> players = playerStream.documents;
for (int i = 0; i < userStream.documents.length; i++) {
if (userStream.documents[i].documentID ==
globals.loggedInUser.uid) {
userDoc = userStream.documents[i];
}
}
return ListView.builder(
itemCount: playerStream.documents.length,
itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Material(
elevation: 2.0,
borderRadius: BorderRadius.all(Radius.circular(10.0)),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Text(
(index + 1).toString(),
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18.0,
color: Colors.indigoAccent,
),
),
),
Text(
playerStream.documents[index]['PlayerName'],
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16.0,
),
),
Padding(
padding: const EdgeInsets.only(right: 8.0),
child: Text(
playerStream.documents[index]
[userDoc['StatTableSort']],
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18.0,
),
),
),
],
),
),
),
);
},
);
}
},
);
}
}
| 0 |
mirrored_repositories/MySoftballTeam | mirrored_repositories/MySoftballTeam/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:my_softball_team/check_login.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
});
}
| 0 |
mirrored_repositories/just_launch | mirrored_repositories/just_launch/lib/main.dart | import 'package:collection/collection.dart';
import 'package:dynamic_color/dynamic_color.dart';
import 'package:flutter/material.dart';
import 'package:package_manager/package_manager.dart';
import 'package:package_manager/package_manager_platform_interface.dart';
import 'package:rxdart/rxdart.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
var fallbackTheme = ColorScheme.fromSeed(
seedColor: Colors.grey,
brightness: Brightness.dark,
background: Colors.black,
).copyWith(primary: Colors.white);
return DynamicColorBuilder(
builder: (_, darkTheme) => MaterialApp(
theme: ThemeData(
colorScheme: darkTheme ?? fallbackTheme,
useMaterial3: true,
),
home: WillPopScope(
onWillPop: () async => false,
child: const Scaffold(
body: MyLauncher(),
),
),
),
);
}
}
class AppListModel {
final PackageManager plugin;
final _search = BehaviorSubject<String>.seeded("");
final _installedApps = BehaviorSubject<List<InstalledApp>>.seeded([]);
AppListModel(this.plugin);
Sink<String> get search => _search.sink;
Future<List<InstalledApp>> _findApps() async => await plugin.getAllApps();
void dispose() {
_search.close();
_installedApps.close();
}
Stream<List<InstalledApp>> get _filteredApps {
return Rx.combineLatest2(
_installedApps,
_search.debounceTime(const Duration(milliseconds: 300)),
(List<InstalledApp> installedApps, String search) {
if (search == "") {
return installedApps;
}
return installedApps
.where(
(app) => app.label.toLowerCase().contains(search.toLowerCase()),
)
.toList();
},
);
}
List<dynamic> _setApps(List<InstalledApp> apps) {
_installedApps.add(apps);
return apps;
}
Stream<List<InstalledApp>> get apps {
return _filteredApps.map(
(apps) => apps
.where((app) => app.label != "just_launch")
.sortedBy((app) => app.label.toLowerCase()),
);
}
Future<void> updateApps() async {
return _findApps().then(_setApps);
}
Future<void> launchPackage(InstalledApp app) {
return plugin.launchApp(app.package);
}
}
class MyLauncher extends StatefulWidget {
const MyLauncher({super.key});
@override
MyLauncherState createState() {
return MyLauncherState();
}
}
class MyLauncherState extends State<MyLauncher> {
final plugin = PackageManager();
late final AppListModel appListModel;
@override
void initState() {
super.initState();
appListModel = AppListModel(plugin);
appListModel.updateApps();
}
@override
void dispose() {
appListModel.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) => AppList(
installedApps: appListModel,
plugin: plugin,
);
}
class AppList extends StatelessWidget {
final AppListModel installedApps;
final PackageManager plugin;
final TextEditingController text = TextEditingController();
AppList({
required this.installedApps,
required this.plugin,
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return StreamBuilder(
stream: installedApps.apps,
builder: (context, AsyncSnapshot<List<InstalledApp>> snapshot) {
Widget child;
final data = snapshot.data;
if (data == null || data.isEmpty) {
child = const Center(
child: Text(
key: Key("loading"),
"Just Launch",
style: TextStyle(fontSize: 36)),
);
} else {
child = Padding(
padding: const EdgeInsets.only(top: 20.0),
child: Center(
child: Column(
children: <Widget>[
SearchTextField(
text: text,
appList: data,
search: installedApps.search,
plugin: plugin,
),
Expanded(
child: RefreshIndicator(
onRefresh: installedApps.updateApps,
child: ListView.builder(
itemCount: data.length,
itemBuilder: (context, index) => AppListButton(
search: installedApps.search,
app: data[index],
text: text,
plugin: plugin,
),
),
),
),
],
),
));
}
return AnimatedSwitcher(
duration: const Duration(milliseconds: 500),
child: child,
);
});
}
}
class AppListButton extends StatelessWidget {
const AppListButton({
Key? key,
required this.text,
required this.app,
required this.search,
required this.plugin,
}) : super(key: key);
final TextEditingController text;
final InstalledApp app;
final Sink<String> search;
final PackageManager plugin;
@override
Widget build(BuildContext context) {
return TextButton(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0),
child: Text(
app.label,
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 26),
),
),
onPressed: () async {
search.add("");
text.clear();
await plugin.launchApp(app.package);
},
onLongPress: () async {
search.add("");
text.clear();
await plugin.launchSettings(app.package);
},
);
}
}
class SearchTextField extends StatelessWidget {
const SearchTextField({
Key? key,
required this.text,
required this.search,
required this.appList,
required this.plugin,
}) : super(key: key);
final TextEditingController text;
final List<InstalledApp> appList;
final Sink<String> search;
final PackageManager plugin;
@override
Widget build(BuildContext context) {
return TextField(
autofocus: true,
autocorrect: false,
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 26),
controller: text,
onChanged: search.add,
onSubmitted: (valueChanged) {
if (appList.isNotEmpty) {
plugin.launchApp(appList[0].package);
}
search.add("");
text.clear();
},
);
}
}
| 0 |
mirrored_repositories/just_launch | mirrored_repositories/just_launch/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:just_launch/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/just_launch/plugins/package_manager | mirrored_repositories/just_launch/plugins/package_manager/lib/package_manager_method_channel.dart | import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package_manager_platform_interface.dart';
class AndroidInstalledApp extends InstalledApp {
final Map<String, String> _inner;
AndroidInstalledApp(this._inner);
@override
String get label => _inner['label']!;
@override
String get package => _inner['package']!;
}
/// An implementation of [PackageManagerPlatform] that uses method channels.
class MethodChannelPackageManager extends PackageManagerPlatform {
/// The method channel used to interact with the native platform.
@visibleForTesting
final methodChannel = const MethodChannel('package_manager');
@override
Future<List<InstalledApp>> getAllApps() async {
final version = await methodChannel.invokeMethod<List>('getAllApps');
return version!.map((element) {
return AndroidInstalledApp(Map.castFrom(element));
}).toList();
}
@override
Future<void> launchApp(String package) async {
await methodChannel
.invokeMethod<bool>('launchApp', {"packageName": package});
}
@override
Future<void> launchSettings(String package) async {
await methodChannel
.invokeMethod<bool>('launchSettings', {"packageName": package});
}
}
| 0 |
mirrored_repositories/just_launch/plugins/package_manager | mirrored_repositories/just_launch/plugins/package_manager/lib/package_manager.dart | import 'package_manager_platform_interface.dart';
class PackageManager {
Future<List<InstalledApp>> getAllApps() async {
return PackageManagerPlatform.instance.getAllApps();
}
Future<void> launchApp(String package) async {
return PackageManagerPlatform.instance.launchApp(package);
}
Future<void> launchSettings(String package) async {
return PackageManagerPlatform.instance.launchSettings(package);
}
}
| 0 |
mirrored_repositories/just_launch/plugins/package_manager | mirrored_repositories/just_launch/plugins/package_manager/lib/package_manager_platform_interface.dart | import 'package:plugin_platform_interface/plugin_platform_interface.dart';
import 'package_manager_method_channel.dart';
abstract class PackageManagerPlatform extends PlatformInterface {
PackageManagerPlatform() : super(token: _token);
static final Object _token = Object();
static PackageManagerPlatform _instance = MethodChannelPackageManager();
/// The default instance of [PackageManagerPlatform] to use.
///
/// Defaults to [MethodChannelPackageManager].
static PackageManagerPlatform get instance => _instance;
/// Platform-specific implementations should set this with their own
/// platform-specific class that extends [PackageManagerPlatform] when
/// they register themselves.
static set instance(PackageManagerPlatform instance) {
PlatformInterface.verifyToken(instance, _token);
_instance = instance;
}
Future<List<InstalledApp>> getAllApps() async {
throw UnimplementedError('getAllApps() has not been implemented.');
}
Future<void> launchApp(String package) async {
throw UnimplementedError('launchApp() has not been implemented.');
}
Future<void> launchSettings(String package) async {
throw UnimplementedError('launchSettings() has not been implemented.');
}
}
abstract class InstalledApp {
String get label;
String get package;
}
| 0 |
mirrored_repositories/just_launch/plugins/package_manager | mirrored_repositories/just_launch/plugins/package_manager/test/package_manager_test.dart | // import 'package:flutter_test/flutter_test.dart';
// import 'package:package_manager/package_manager.dart';
// import 'package:package_manager/package_manager_platform_interface.dart';
// import 'package:package_manager/package_manager_method_channel.dart';
// import 'package:plugin_platform_interface/plugin_platform_interface.dart';
// class MockPackageManagerPlatform
// with MockPlatformInterfaceMixin
// implements PackageManagerPlatform {
// @override
// Future<String?> getPlatformVersion() => Future.value('42');
// }
// void main() {
// final PackageManagerPlatform initialPlatform = PackageManagerPlatform.instance;
// test('$MethodChannelPackageManager is the default instance', () {
// expect(initialPlatform, isInstanceOf<MethodChannelPackageManager>());
// });
// test('getPlatformVersion', () async {
// PackageManager packageManagerPlugin = PackageManager();
// MockPackageManagerPlatform fakePlatform = MockPackageManagerPlatform();
// PackageManagerPlatform.instance = fakePlatform;
// expect(await packageManagerPlugin.getPlatformVersion(), '42');
// });
// }
| 0 |
mirrored_repositories/just_launch/plugins/package_manager | mirrored_repositories/just_launch/plugins/package_manager/test/package_manager_method_channel_test.dart | // import 'package:flutter/services.dart';
// import 'package:flutter_test/flutter_test.dart';
// import 'package:package_manager/package_manager_method_channel.dart';
// void main() {
// MethodChannelPackageManager platform = MethodChannelPackageManager();
// const MethodChannel channel = MethodChannel('package_manager');
// TestWidgetsFlutterBinding.ensureInitialized();
// setUp(() {
// channel.setMockMethodCallHandler((MethodCall methodCall) async {
// return '42';
// });
// });
// tearDown(() {
// channel.setMockMethodCallHandler(null);
// });
// test('getPlatformVersion', () async {
// expect(await platform.getPlatformVersion(), '42');
// });
// }
| 0 |
mirrored_repositories/just_launch/plugins/package_manager/example | mirrored_repositories/just_launch/plugins/package_manager/example/lib/main.dart | import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:package_manager/package_manager.dart';
import 'package:package_manager/package_manager_platform_interface.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
List<InstalledApp> _platformVersion = [];
final _packageManagerPlugin = PackageManager();
@override
void initState() {
super.initState();
initPlatformState();
}
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> initPlatformState() async {
List<InstalledApp> platformVersion;
// Platform messages may fail, so we use a try/catch PlatformException.
// We also handle the message potentially returning null.
try {
platformVersion = await _packageManagerPlugin.getAllApps();
} on PlatformException {
platformVersion = [];
}
// If the widget was removed from the tree while the asynchronous platform
// message was in flight, we want to discard the reply rather than calling
// setState to update our non-existent appearance.
if (!mounted) return;
setState(() {
_platformVersion = platformVersion;
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: ListView.builder(
itemBuilder: (context, i) {
final name = _platformVersion[i].label;
final package = _platformVersion[i].package;
return ListTile(
title: Text(name),
subtitle: Text(package),
onTap: () async {
await _packageManagerPlugin.launchApp(package);
},
onLongPress: () async {
await _packageManagerPlugin.launchSettings(package);
},
);
},
itemCount: _platformVersion.length,
)),
);
}
}
| 0 |
mirrored_repositories/just_launch/plugins/package_manager/example | mirrored_repositories/just_launch/plugins/package_manager/example/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:package_manager_example/main.dart';
// void main() {
// testWidgets('Verify Platform version', (WidgetTester tester) async {
// // Build our app and trigger a frame.
// await tester.pumpWidget(const MyApp());
// // Verify that platform version is retrieved.
// expect(
// find.byWidgetPredicate(
// (Widget widget) => widget is Text &&
// widget.data!.startsWith('Running on:'),
// ),
// findsOneWidget,
// );
// });
// }
| 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.