repo_id
stringlengths
21
168
file_path
stringlengths
36
210
content
stringlengths
1
9.98M
__index_level_0__
int64
0
0
mirrored_repositories/Auth_System_Appwrite/lib
mirrored_repositories/Auth_System_Appwrite/lib/widget/make_elevated_button.dart
import 'package:auth_system/widget/make_text.dart'; import 'package:flutter/material.dart'; Widget makeElevatedButton( String textString, { required Function onPressed, Size? minimumSize, double? textSize, }) { return ElevatedButton( onPressed: () => onPressed, style: ElevatedButton.styleFrom( primary: Colors.amberAccent, onPrimary: Colors.black, minimumSize: minimumSize, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(19), ), ), child: makeText( textString, size: textSize, ), ); }
0
mirrored_repositories/Auth_System_Appwrite/lib
mirrored_repositories/Auth_System_Appwrite/lib/widget/make_text_field.dart
import 'package:flutter/material.dart'; Widget makeTextField( {String? hintText, required TextEditingController controller, bool? obscureText, Widget? suffixIcon, FocusNode? focusNode, Function(String)? onFieldSubmitted, TextInputAction? textInputAction, bool? autofocus}) { return TextFormField( autofocus: autofocus ?? false, focusNode: focusNode, textInputAction: textInputAction, onFieldSubmitted:(value) => onFieldSubmitted, controller: controller, obscureText: obscureText ?? false, decoration: InputDecoration( suffixIcon: suffixIcon, hintText: hintText, hintStyle: const TextStyle(color: Colors.grey), focusedBorder: OutlineInputBorder( borderSide: const BorderSide( color: Colors.grey, ), borderRadius: BorderRadius.circular(15), ), enabledBorder: OutlineInputBorder( borderSide: const BorderSide( color: Colors.grey, ), borderRadius: BorderRadius.circular(15), ), errorBorder: OutlineInputBorder( borderSide: const BorderSide( color: Colors.grey, ), borderRadius: BorderRadius.circular(15), ), filled: true, fillColor: Colors.grey.withOpacity(0.06), ), ); }
0
mirrored_repositories/Auth_System_Appwrite/lib
mirrored_repositories/Auth_System_Appwrite/lib/widget/make_text_button.dart
import 'package:auth_system/widget/make_text.dart'; import 'package:flutter/material.dart'; Widget makeTextButton( String textString, { required Function onPressed, }) { return TextButton(onPressed: () => onPressed, child: makeText(textString)); }
0
mirrored_repositories/Auth_System_Appwrite/lib
mirrored_repositories/Auth_System_Appwrite/lib/widget/route.dart
import 'package:flutter/material.dart'; push(BuildContext context, Widget widget) { Navigator.push(context, MaterialPageRoute(builder: (_) => widget)); } pushReplacement(BuildContext context, Widget widget) { Navigator.pushReplacement(context, MaterialPageRoute(builder: (_) => widget)); } pop(BuildContext context) { Navigator.pop(context); }
0
mirrored_repositories/Auth_System_Appwrite/lib
mirrored_repositories/Auth_System_Appwrite/lib/widget/make_text.dart
import 'package:flutter/material.dart'; Widget makeText( String textString, { Color? textColor, double? size, FontWeight? fontWeight, }) { return Text( textString, style: TextStyle( color: textColor, fontSize: size, fontWeight: fontWeight, ), ); }
0
mirrored_repositories/Auth_System_Appwrite
mirrored_repositories/Auth_System_Appwrite/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:auth_system/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/animations
mirrored_repositories/animations/lib/main.dart
import 'package:flutter/material.dart'; import 'screens/login/login_screen.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Animations', debugShowCheckedModeBanner: false, home: LoginScreen(), theme: ThemeData( brightness: Brightness.dark, primaryColor: const Color(0xFFFF4D00), accentColor: const Color(0xFFFF4D00), fontFamily: 'OpenSans', ) ); } }
0
mirrored_repositories/animations/lib/screens
mirrored_repositories/animations/lib/screens/login/login_screen.dart
import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart' show timeDilation; import '../home/home_screen.dart'; import 'widgets/form_container.dart'; import 'widgets/sign_up_button.dart'; import 'widgets/stagger_animation.dart'; class LoginScreen extends StatefulWidget { @override _LoginScreenState createState() => _LoginScreenState(); } class _LoginScreenState extends State<LoginScreen> with SingleTickerProviderStateMixin { AnimationController _animationController; @override void initState() { super.initState(); _animationController = AnimationController(vsync: this, duration: Duration(seconds: 2)); _animationController.addStatusListener((status) { if (status == AnimationStatus.completed) { Navigator.of(context).pushReplacement( MaterialPageRoute(builder: (context) => HomeScreen()) ); } }); } @override void dispose() { _animationController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { timeDilation = 0.8; return Scaffold( body: Container( decoration: BoxDecoration( image: DecorationImage( image: AssetImage('assets/images/background.jpg'), fit: BoxFit.cover, ), ), child: ListView( padding: EdgeInsets.zero, children: <Widget>[ Stack( alignment: Alignment.bottomCenter, children: <Widget>[ Column( children: <Widget>[ Padding( padding: EdgeInsets.only(top: 50, bottom: 25), child: Image.asset('assets/images/check.png', width: 120, height: 120, fit: BoxFit.contain ), ), FormContainer(), SignUpButton(), ], ), StaggerAnimation(controller: _animationController.view) ], ), ], ), ), ); } }
0
mirrored_repositories/animations/lib/screens/login
mirrored_repositories/animations/lib/screens/login/widgets/form_container.dart
import 'package:flutter/material.dart'; import 'input_field.dart'; class FormContainer extends StatelessWidget { @override Widget build(BuildContext context) { return Container( margin: EdgeInsets.symmetric(horizontal: 25), child: Form( child: Column( children: <Widget>[ InputField( hint: 'Username', obscure: false, icon: Icons.person_outline_rounded, ), InputField( hint: 'Password', obscure: true, icon: Icons.lock_outline_rounded ), ], ), ), ); } }
0
mirrored_repositories/animations/lib/screens/login
mirrored_repositories/animations/lib/screens/login/widgets/input_field.dart
import 'package:flutter/material.dart'; class InputField extends StatelessWidget { final String hint; final bool obscure; final IconData icon; InputField({this.hint, this.obscure, this.icon}); @override Widget build(BuildContext context) { return Container( decoration: BoxDecoration( border: Border( bottom: BorderSide( color: Colors.white24, width: 0.5 ), ), ), child: TextFormField( obscureText: obscure, style: TextStyle( color: Colors.white, ), decoration: InputDecoration( icon: Icon( icon, color: Colors.white, ), border: InputBorder.none, hintText: hint, hintStyle: TextStyle( color: Colors.white, fontSize: 18, ), contentPadding: EdgeInsets.fromLTRB(5, 30, 30, 30) ), ), ); } }
0
mirrored_repositories/animations/lib/screens/login
mirrored_repositories/animations/lib/screens/login/widgets/sign_up_button.dart
import 'package:flutter/material.dart'; class SignUpButton extends StatelessWidget { @override Widget build(BuildContext context) { return FlatButton( padding: EdgeInsets.only(top: 180), onPressed: (){}, child: Text( 'Register', textAlign: TextAlign.center, style: TextStyle( fontWeight: FontWeight.bold, color: Colors.white, fontSize: 16, letterSpacing: 1 ), ), ); } }
0
mirrored_repositories/animations/lib/screens/login
mirrored_repositories/animations/lib/screens/login/widgets/stagger_animation.dart
import 'package:flutter/material.dart'; class StaggerAnimation extends StatelessWidget { final AnimationController controller; StaggerAnimation({this.controller}) : buttonSqueeze = Tween( begin: 250.0, end: 50.0, ).animate( CurvedAnimation( parent: controller, curve: Interval(0.0, 0.150), ), ), buttonZoomOut = Tween<double>( begin: 60.0, end: 1000.0, ).animate( CurvedAnimation( parent: controller, curve: Interval(0.5, 1, curve: Curves.bounceOut), ), ); final Animation<double> buttonSqueeze; final Animation<double> buttonZoomOut; Widget _buildAnimation(BuildContext context, Widget child) { return Padding( padding: EdgeInsets.only(bottom: 60), child: InkWell( onTap: () { controller.forward(); }, child: Hero( tag: 'fade', child: buttonZoomOut.value == 60 ? Container( width: buttonSqueeze.value, height: 50, alignment: Alignment.center, decoration: BoxDecoration( color: Theme.of(context).primaryColor, borderRadius: BorderRadius.all(Radius.circular(30))), child: _buildInside(context), ) : Container( width: buttonZoomOut.value, height: buttonZoomOut.value, decoration: BoxDecoration( color: Theme.of(context).primaryColor, shape: buttonZoomOut.value < 500 ? BoxShape.circle : BoxShape.rectangle ), ), ), ), ); } Widget _buildInside(BuildContext context) { if (buttonSqueeze.value > 80) { return Text( 'Sign In', style: TextStyle( color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold, letterSpacing: 1), ); } else { return CircularProgressIndicator( valueColor: AlwaysStoppedAnimation<Color>(Colors.white), strokeWidth: 1.0, ); } } @override Widget build(BuildContext context) { return AnimatedBuilder( builder: _buildAnimation, animation: controller, ); } }
0
mirrored_repositories/animations/lib/screens
mirrored_repositories/animations/lib/screens/home/home_screen.dart
import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart' show timeDilation; import 'widgets/stagger_animation.dart'; class HomeScreen extends StatefulWidget { @override _HomeScreenState createState() => _HomeScreenState(); } class _HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateMixin { AnimationController _controller; @override void initState() { super.initState(); _controller = AnimationController( vsync: this, duration: Duration(milliseconds: 2000)); _controller.forward(); } @override void dispose() { _controller.dispose(); super.dispose(); } @override Widget build(BuildContext context) { timeDilation = 1.5; return StaggerAnimation( controller: _controller.view, ); } }
0
mirrored_repositories/animations/lib/screens/home
mirrored_repositories/animations/lib/screens/home/widgets/category_view.dart
import 'package:flutter/material.dart'; class CategoryView extends StatefulWidget { @override _CategoryViewState createState() => _CategoryViewState(); } class _CategoryViewState extends State<CategoryView> { final List<String> categories = [ 'Work', 'Studies', 'Home', ]; int _category = 0; void selectBackward() { setState(() { _category--; }); } void selectFoward() { setState(() { _category++; }); } @override Widget build(BuildContext context) { return Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ IconButton( icon: Icon(Icons.arrow_back_ios_rounded), disabledColor: Colors.white54, onPressed: _category > 0 ? selectBackward : null, ), Text(categories[_category].toUpperCase(), textAlign: TextAlign.center, style: TextStyle( color: Colors.white, fontSize: 15, letterSpacing: 2, fontWeight: FontWeight.w100) ), IconButton( icon: Icon(Icons.arrow_forward_ios_rounded), disabledColor: Colors.white54, onPressed: _category < categories.length - 1 ? selectFoward : null, ), ], ); } }
0
mirrored_repositories/animations/lib/screens/home
mirrored_repositories/animations/lib/screens/home/widgets/home_top.dart
import 'package:flutter/material.dart'; import 'category_view.dart'; class HomeTop extends StatelessWidget { final Animation<double> containerGrow; HomeTop({@required this.containerGrow}); @override Widget build(BuildContext context) { final screenSize = MediaQuery.of(context).size; return Container( height: screenSize.height * 0.4, decoration: BoxDecoration( image: DecorationImage( image: AssetImage('assets/images/background.jpg'), fit: BoxFit.cover, ), ), child: SafeArea( child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[ Container( margin: EdgeInsets.only(top: 10), alignment: Alignment.topRight, width: containerGrow.value * 100, height: containerGrow.value * 100, decoration: BoxDecoration( shape: BoxShape.circle, image: DecorationImage( image: AssetImage('assets/images/profile.png'), fit: BoxFit.cover), ), child: Container( margin: EdgeInsets.only(left: 75), alignment: Alignment.center, width: containerGrow.value * 30, height: containerGrow.value * 30, child: Text('5', style: TextStyle( fontSize: containerGrow.value * 15, fontWeight: FontWeight.bold, color: Colors.white, ) ), decoration: BoxDecoration( shape: BoxShape.circle, color: Theme.of(context).primaryColor, ), ), ), Text( 'Welcome, Felipe!', style: TextStyle( fontSize: 18, fontWeight: FontWeight.bold, color: Colors.white, letterSpacing: 1), ), CategoryView(), ] ), ), ); } }
0
mirrored_repositories/animations/lib/screens/home
mirrored_repositories/animations/lib/screens/home/widgets/animated_list_view.dart
import 'package:flutter/material.dart'; import 'list_data.dart'; class AnimatedListView extends StatelessWidget { final Animation<EdgeInsets> listSlidePosition; AnimatedListView({@required this.listSlidePosition}); @override Widget build(BuildContext context) { return Stack( alignment: Alignment.bottomCenter, children: <Widget>[ ListData( title: 'I\'m Felipe Sales', subtitle: 'I like to study', image: AssetImage('assets/images/profile.png'), margin: listSlidePosition.value * 4, ), ListData( title: 'My GitHub', subtitle: 'Here\'s my Projects', image: AssetImage('assets/images/github.png'), margin: listSlidePosition.value * 3, ), ListData( title: 'Flutter Study', subtitle: 'I study a lot of Flutter', image: AssetImage('assets/images/flutter.png'), margin: listSlidePosition.value * 2, ), ListData( title: 'Dart Study', subtitle: 'also study dart', image: AssetImage('assets/images/dart.png'), margin: listSlidePosition.value * 1, ), ListData( title: 'My LinkedIn', subtitle: 'See my LinkedIn', image: AssetImage('assets/images/linkedin.png'), margin: listSlidePosition.value * 0, ), ] ); } }
0
mirrored_repositories/animations/lib/screens/home
mirrored_repositories/animations/lib/screens/home/widgets/fade_container.dart
import 'package:flutter/material.dart'; class FadeContainer extends StatelessWidget { final Animation<Color> fadeAnimation; const FadeContainer({this.fadeAnimation}); @override Widget build(BuildContext context) { return Hero( tag: 'fade', child: Container( decoration: BoxDecoration( color: fadeAnimation.value, ) ), ); } }
0
mirrored_repositories/animations/lib/screens/home
mirrored_repositories/animations/lib/screens/home/widgets/list_data.dart
import 'package:flutter/material.dart'; class ListData extends StatelessWidget { final String title; final String subtitle; final ImageProvider image; final EdgeInsets margin; const ListData({this.title, this.subtitle, this.image, this.margin}); @override Widget build(BuildContext context) { return Container( margin: margin, decoration: BoxDecoration( color: Colors.grey[50], border: Border( top: BorderSide(color: Colors.grey[200], width: 1), bottom: BorderSide(color: Colors.grey[300], width: 1) ) ), child: Row( children: <Widget>[ Container( margin: EdgeInsets.all(14), width: 50, height: 50, decoration: BoxDecoration( shape: BoxShape.circle, image: DecorationImage( image: image, fit: BoxFit.cover ) ), ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( title, style: TextStyle( color: Colors.grey[900], fontSize: 16, fontWeight: FontWeight.bold, ) ), SizedBox(height: 4), Text( subtitle, style: TextStyle( fontSize: 14, color: Colors.grey[800], fontWeight: FontWeight.bold, ) ) ] ), ] ), ); } }
0
mirrored_repositories/animations/lib/screens/home
mirrored_repositories/animations/lib/screens/home/widgets/stagger_animation.dart
import 'package:flutter/material.dart'; import 'animated_list_view.dart'; import 'fade_container.dart'; import 'home_top.dart'; class StaggerAnimation extends StatelessWidget { final AnimationController controller; StaggerAnimation({@required this.controller}) : containerGrow = CurvedAnimation(parent: controller, curve: Curves.ease), listSlidePosition = EdgeInsetsTween( begin: EdgeInsets.only(bottom: 0), end: EdgeInsets.only(bottom: 80)) .animate( CurvedAnimation( parent: controller, curve: Interval(0.3, 0.8, curve: Curves.ease), ), ), fadeAnimation = ColorTween( begin: const Color.fromRGBO(255, 77, 0, 1.0), end: const Color.fromRGBO(255, 129, 0, 0.0), ).animate( CurvedAnimation( parent: controller, curve: Interval(0.3, 0.8, curve: Curves.decelerate), ), ); final Animation<double> containerGrow; final Animation<EdgeInsets> listSlidePosition; final Animation<Color> fadeAnimation; Widget _buildAnimation(BuildContext context, Widget child) { return Stack( children: <Widget>[ ListView( padding: EdgeInsets.zero, children: <Widget>[ HomeTop(containerGrow: containerGrow), AnimatedListView(listSlidePosition: listSlidePosition), ] ), IgnorePointer( child: FadeContainer( fadeAnimation: fadeAnimation, ), ), ]); } @override Widget build(BuildContext context) { return Scaffold( body: Container( color: Colors.grey[200], child: AnimatedBuilder( animation: controller, builder: _buildAnimation, ), ), ); } }
0
mirrored_repositories/Job-Listing
mirrored_repositories/Job-Listing/lib/category_list_screen.dart
import "package:flutter/material.dart"; import 'package:google_fonts/google_fonts.dart'; import 'package:job_listing/category_card_widget.dart'; class CategoryListScreen extends StatefulWidget { @override _CategoryListScreenState createState() => _CategoryListScreenState(); } class _CategoryListScreenState extends State<CategoryListScreen> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text("Home"), centerTitle: true, ), body: Padding( padding: const EdgeInsets.only(left: 10.0, top: 10.0, right: 10.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( "Find Jobs", style: GoogleFonts.mPlusRounded1c( fontWeight: FontWeight.bold, fontSize: 24.0), ), SizedBox( height: 10.0, ), Expanded( child: GridView.count( physics: BouncingScrollPhysics(), scrollDirection: Axis.vertical, crossAxisCount: 2, crossAxisSpacing: 10.0, mainAxisSpacing: 10.0, children: <Widget>[ CategoryCard( iconImage: "assets/icons/design.png", categoryName: "Designer"), CategoryCard( iconImage: "assets/icons/html.png", categoryName: "Developer"), CategoryCard( iconImage: "assets/icons/manager.png", categoryName: "Manager"), CategoryCard( iconImage: "assets/icons/classroom.png", categoryName: "Teacher"), CategoryCard( iconImage: "assets/icons/internship.png", categoryName: "Internship"), CategoryCard( iconImage: "assets/icons/driver.png", categoryName: "Driver"), CategoryCard( iconImage: "assets/icons/engineer.png", categoryName: "Engineer"), CategoryCard( iconImage: "assets/icons/woman_pilot.png", categoryName: "Pilot") ], ), ) ], ), ), ); } }
0
mirrored_repositories/Job-Listing
mirrored_repositories/Job-Listing/lib/category_clients_screen.dart
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:job_listing/user_profile_widget.dart'; class CategoryClientsScreen extends StatefulWidget { final String categoryName; const CategoryClientsScreen({Key key, @required this.categoryName}) : super(key: key); @override _CategoryClientsScreenState createState() => _CategoryClientsScreenState(); } class _CategoryClientsScreenState extends State<CategoryClientsScreen> { @override Widget build(BuildContext context) { var categoryName = widget.categoryName; return Scaffold( appBar: AppBar( title: Text( categoryName, style: GoogleFonts.mPlusRounded1c( fontSize: 24.0, fontWeight: FontWeight.bold, color: Colors.black12), ), actions: <Widget>[ Padding( padding: const EdgeInsets.only(right: 10.0), child: GestureDetector( onTap: () { print("Tapped working"); }, child: ImageIcon( AssetImage("assets/icons/filter.png"), color: Colors.orange[400], size: 30.0, ), ), ) ], ), body: ListView( physics: BouncingScrollPhysics(), children: <Widget>[ SizedBox( height: 10.0, ), UserProfileWidget( profileImage: "assets/images/will.JPG", profileName: "William Kwabla", jobTitle: "UX/UI Designer", country: "USA", yearsOfExperience: 4, ), UserProfileWidget( profileImage: "assets/images/female_user.png", profileName: "Julian Wan", jobTitle: "Product Designer", country: "USA", yearsOfExperience: 2, ), UserProfileWidget( profileImage: "assets/images/user_male.png", profileName: "Kas", jobTitle: "Frontend Designer", country: "UK", yearsOfExperience: 5, ), UserProfileWidget( profileImage: "assets/images/Oliver.jpeg", profileName: "Oliver Boamah", jobTitle: "Mobile Designer", country: "USA", yearsOfExperience: 4, ), UserProfileWidget( profileImage: "assets/images/son.png", profileName: "Kwabena Yeboah", jobTitle: "Web Designer", country: "Germany", yearsOfExperience: 4, ), UserProfileWidget( profileImage: "assets/icons/manager.png", profileName: "William Kwabla", jobTitle: "UX/UI Designer", country: "USA", yearsOfExperience: 4, ), ], ), ); } }
0
mirrored_repositories/Job-Listing
mirrored_repositories/Job-Listing/lib/user_profile_widget.dart
import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; class UserProfileWidget extends StatefulWidget { final String profileImage; final String profileName; final String jobTitle; final String country; final int yearsOfExperience; const UserProfileWidget( {Key key, @required this.profileImage, @required this.profileName, @required this.jobTitle, @required this.country, @required this.yearsOfExperience}) : super(key: key); @override _UserProfileWidgetState createState() => _UserProfileWidgetState(); } class _UserProfileWidgetState extends State<UserProfileWidget> { @override Widget build(BuildContext context) { String profileImage = widget.profileImage; String profileName = widget.profileName; String jobTitle = widget.jobTitle; String country = widget.country; int yearsOfExperience = widget.yearsOfExperience; return Card( margin: const EdgeInsets.only(left: 10.0, right: 10.0, bottom: 10.0), elevation: 5.0, child: Container( width: 335.0, height: 119.0, child: Row( children: <Widget>[ Padding( padding: const EdgeInsets.only(left: 17.0, right: 13.0), child: CircleAvatar( backgroundImage: AssetImage(profileImage), radius: 40.0, ), ), Expanded( child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( profileName, overflow: TextOverflow.ellipsis, maxLines: 1, style: GoogleFonts.mPlusRounded1c( fontSize: 14.0, fontWeight: FontWeight.bold, color: Colors.black), ), Text( jobTitle, overflow: TextOverflow.ellipsis, maxLines: 1, style: GoogleFonts.mPlusRounded1c( fontSize: 11.0, fontWeight: FontWeight.w600, color: Colors.grey), ), Text( country, overflow: TextOverflow.ellipsis, maxLines: 1, style: GoogleFonts.mPlusRounded1c( fontSize: 11.0, fontWeight: FontWeight.w600, color: Colors.grey), ), Text( "$yearsOfExperience years Experience", overflow: TextOverflow.ellipsis, maxLines: 1, style: GoogleFonts.mPlusRounded1c( fontSize: 11.0, fontWeight: FontWeight.bold, color: Colors.blue[800]), ) ], ), ) ], ), ), ); } }
0
mirrored_repositories/Job-Listing
mirrored_repositories/Job-Listing/lib/main.dart
import 'package:flutter/material.dart'; import 'package:job_listing/category_clients_screen.dart'; import 'package:job_listing/category_list_screen.dart'; //import 'package:device_preview/device_preview.dart'; void main() => runApp(JobListinApp()); // void main() => runApp( // DevicePreview( // builder: (context) => JobListinApp(), // ), // ); class JobListinApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, title: 'Job Listing', theme: ThemeData( primarySwatch: Colors.blueGrey, ), initialRoute: "/", routes: { "/": (context) => CategoryListScreen(), "/category-clients": (context) => CategoryClientsScreen() }, ); } }
0
mirrored_repositories/Job-Listing
mirrored_repositories/Job-Listing/lib/category_card_widget.dart
import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:job_listing/category_clients_screen.dart'; class CategoryCard extends StatefulWidget { final String iconImage; final String categoryName; const CategoryCard({ Key key, @required this.iconImage, @required this.categoryName, }) : super(key: key); @override _CategoryCardState createState() => _CategoryCardState(); } class _CategoryCardState extends State<CategoryCard> { @override Widget build(BuildContext context) { var iconImage = widget.iconImage; var categoryName = widget.categoryName; return GestureDetector( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => CategoryClientsScreen(categoryName: categoryName))); }, child: Card( elevation: 5.0, child: Container( width: 156.0, height: 156.0, child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[ Image( image: AssetImage(iconImage), height: 100.0, width: 100.0, ), Text( categoryName, style: GoogleFonts.mPlusRounded1c( fontSize: 14.0, fontWeight: FontWeight.bold), ) ], ), ), ), ); } }
0
mirrored_repositories/Job-Listing
mirrored_repositories/Job-Listing/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:job_listing/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(JobListinApp()); // 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/Fise
mirrored_repositories/Fise/lib/thank_you.dart
import 'package:flutter/material.dart'; class ThankYouPage extends StatefulWidget { @override _ThankYouPageState createState() => _ThankYouPageState(); } class _ThankYouPageState extends State<ThankYouPage> { @override Widget build(BuildContext context) { return Scaffold( body: Center( child: Card( margin: EdgeInsets.all(25.0), shape: BeveledRectangleBorder(), child: Padding( padding: EdgeInsets.all(30.0), child: Column( mainAxisSize: MainAxisSize.min, children: <Widget>[ const ListTile( title: Text('Fise Survey', style: TextStyle( fontSize: 19, fontWeight: FontWeight.bold, )), subtitle: Text('Thank You For your time.', style: TextStyle( height: 2.5, fontSize: 16, )), ), ButtonTheme.bar( // make buttons use the appropriate styles for cards child: ButtonBar( children: <Widget>[ FlatButton( child: const Text( 'Done', style: TextStyle( fontSize: 20, ), ), onPressed: () { Navigator.of(context) .pushNamedAndRemoveUntil('/', (_) => false); }, ), ], ), ), ], ), ), // This trailing comma makes auto-formatting nicer for build methods. ), )); } }
0
mirrored_repositories/Fise
mirrored_repositories/Fise/lib/main.dart
import 'package:flutter/material.dart'; import 'package:fise/surveys/survey_1.dart'; import 'package:fise/surveys/survey_2.dart'; import 'package:fise/surveys/survey_3.dart'; import 'package:fise/surveys/survey_4.dart'; import 'package:fise/surveys/survey_5.dart'; import 'package:fise/surveys/survey_6.dart'; import 'slide_right_transition.dart'; import 'thank_you.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( title: 'Fise', theme: ThemeData( primarySwatch: Colors.deepOrange, ), home: FiseHomePage(title: 'Fise Survey'), onGenerateRoute: (RouteSettings settings) { // Routing with animation transition switch (settings.name) { case '/income': return SlideRightRoute(widget: IncomeSurvey()); break; case '/household_income': return SlideRightRoute(widget: HouseholdSurvey()); break; case '/savings': return SlideRightRoute(widget: SavingsSurvey()); break; case '/spending': return SlideRightRoute(widget: SpendingSurvey()); break; case '/finance_knowledge': return SlideRightRoute(widget: FinanceKnowledgeSurvey()); break; case '/occupation': return SlideRightRoute(widget: OccupationSurvey()); break; case '/thank_you': return SlideRightRoute(widget: ThankYouPage()); break; } }, ); } } class FiseHomePage extends StatefulWidget { FiseHomePage({Key key, this.title}) : super(key: key); final String title; @override _FiseHomePageState createState() => _FiseHomePageState(); } class _FiseHomePageState extends State<FiseHomePage> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( // Here we take the value from the MyHomePage object that was created by // the App.build method, and use it to set our appbar title. title: Text(widget.title), ), body: Center( child: Card( margin: EdgeInsets.all(25.0), shape: BeveledRectangleBorder(), child: Padding( padding: EdgeInsets.all(30.0), child: Column( mainAxisSize: MainAxisSize.min, children: <Widget>[ const ListTile( title: Text('Fise Survey', style: TextStyle( fontSize: 19, )), subtitle: Text( 'Welcome to Fise Survey ,please spare 5-6 min of your time to answer some few questions', style: TextStyle( height: 2.5, fontSize: 16, )), ), ButtonTheme.bar( // make buttons use the appropriate styles for cards child: ButtonBar( children: <Widget>[ FlatButton( child: const Text( 'OK', style: TextStyle( fontSize: 20, ), ), onPressed: () { Navigator.of(context).pushNamed('/income'); }, ), ], ), ), ], ), ), // This trailing comma makes auto-formatting nicer for build methods. ), )); } }
0
mirrored_repositories/Fise
mirrored_repositories/Fise/lib/slide_right_transition.dart
import 'package:flutter/material.dart'; class SlideRightRoute extends PageRouteBuilder { final Widget widget; SlideRightRoute({this.widget}) : super(pageBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation) { return widget; }, transitionsBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, Widget child) { return new SlideTransition( position: new Tween<Offset>( begin: const Offset(-1.0, 0.0), end: Offset.zero, ).animate(animation), child: child, ); }); }
0
mirrored_repositories/Fise/lib
mirrored_repositories/Fise/lib/surveys/survey_3.dart
import 'package:flutter/material.dart'; import '../main.dart'; import '../utils/constants.dart'; class SavingsSurvey extends StatefulWidget { @override _SavingSurveyState createState() => _SavingSurveyState(); } class _SavingSurveyState extends State<SavingsSurvey> { // state variable int _radiovalue = 0; void _handleRadioValueChange(int value) { setState(() { _radiovalue = value; }); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(TITLES['saving']), elevation: 4.0, ), body: Center( child: Card( shape: BeveledRectangleBorder(), child: Padding( padding: EdgeInsets.all(30.0), child: Column(children: <Widget>[ Text('Select one of the following:', style: TextStyle( fontSize: 20.0, fontWeight: FontWeight.bold)), Center( child: Padding( padding: EdgeInsets.all(20.0), child: Text( 'Your Monthly Savings is:', style: TextStyle( fontWeight: FontWeight.normal, fontSize: 18.0, ), textAlign: TextAlign.center, ))), Radio( value: 0, groupValue: _radiovalue, onChanged: _handleRadioValueChange, ), Text( 'Below 30,000', style: TextStyle(fontSize: 16.0), ), Radio( value: 1, groupValue: _radiovalue, onChanged: _handleRadioValueChange, ), Text( 'Above 30,001', style: TextStyle(fontSize: 16.0), ), Radio( value: 2, groupValue: _radiovalue, onChanged: _handleRadioValueChange, ), Text( 'Above 80,000', style: TextStyle(fontSize: 16.0), ), Radio( value: 3, groupValue: _radiovalue, onChanged: _handleRadioValueChange, ), Text( 'Above 150,000', style: TextStyle(fontSize: 16.0), ), Radio( value: 3, groupValue: _radiovalue, onChanged: _handleRadioValueChange, ), Text( '300,001 and above', style: TextStyle(fontSize: 16.0), ), Padding( padding: EdgeInsets.all(20.0), child: RaisedButton( color: Theme.of(context).accentColor, elevation: 4.0, splashColor: Colors.white, onPressed: () { Navigator.of(context) .pushNamed('/finance_knowledge'); }, child: Text('Next'), )) ]))), )); } }
0
mirrored_repositories/Fise/lib
mirrored_repositories/Fise/lib/surveys/survey_2.dart
import 'package:flutter/material.dart'; import '../main.dart'; import '../utils/constants.dart'; class IncomeSurvey extends StatefulWidget { @override _IncomeSurveyState createState() => _IncomeSurveyState(); } class _IncomeSurveyState extends State<IncomeSurvey> { // state variable int _radiovalue = 0; void _handleRadioValueChange(int value) { setState(() { _radiovalue = value; }); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(TITLES['income']), elevation: 4.0, ), body: Center( child: Card( shape: BeveledRectangleBorder(), child: Padding( padding: EdgeInsets.all(30.0), child: Column(children: <Widget>[ Text('Select one of the following:', style: TextStyle( fontSize: 20.0, fontWeight: FontWeight.bold)), Container( child: Padding( padding: EdgeInsets.all(20.0), child: Text( 'Your Income Bracket is between :', style: TextStyle( fontWeight: FontWeight.normal, fontSize: 18.0, ), ))), Radio( value: 0, groupValue: _radiovalue, onChanged: _handleRadioValueChange, ), Text( '0 - 30,000', style: TextStyle(fontSize: 16.0), ), Radio( value: 1, groupValue: _radiovalue, onChanged: _handleRadioValueChange, ), Text( '30,001 - 80,000', style: TextStyle(fontSize: 16.0), ), Radio( value: 2, groupValue: _radiovalue, onChanged: _handleRadioValueChange, ), Text( '80,001 - 150,000', style: TextStyle(fontSize: 16.0), ), Radio( value: 3, groupValue: _radiovalue, onChanged: _handleRadioValueChange, ), Text( '150,001 - 300,000', style: TextStyle(fontSize: 16.0), ), Radio( value: 4, groupValue: _radiovalue, onChanged: _handleRadioValueChange, ), Text( '300,001 and above', style: TextStyle(fontSize: 16.0), ), Padding( padding: EdgeInsets.all(20.0), child: RaisedButton( color: Theme.of(context).accentColor, elevation: 4.0, splashColor: Colors.white, onPressed: () { Navigator.of(context) .pushNamed('/household_income'); }, child: Text('Next'), )) ]))), )); } }
0
mirrored_repositories/Fise/lib
mirrored_repositories/Fise/lib/surveys/survey_6.dart
import 'package:flutter/material.dart'; import '../main.dart'; import '../utils/constants.dart'; class OccupationSurvey extends StatefulWidget { @override _OccupationSurveyState createState() => _OccupationSurveyState(); } //State is information of the application that can change over time or when some actions are taken. class _OccupationSurveyState extends State<OccupationSurvey> { // Create a text controller. We will use it to retrieve the current value // of the TextField on changed final textEditController = TextEditingController(); bool _isNotValid = true; @override void initState() { super.initState(); // Start listening to changes textEditController.addListener(_latestValue); } String _latestValue() { return textEditController.text; } @override void dispose() { // Clean up the controller when the Widget is removed from the Widget tree textEditController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(TITLES['occupation']), ), body: Container( padding: EdgeInsets.all(32.0), child: Center( child: Column( children: <Widget>[ Center( child: Padding( padding: EdgeInsets.all(20.0), child: Text( 'What is your current occupation ? ', style: TextStyle( fontWeight: FontWeight.normal, fontSize: 18.0, ), textAlign: TextAlign.center, ))), Container( margin: EdgeInsets.all(15.0), child: TextField( controller: textEditController, decoration: new InputDecoration( hintText: "e.g Butcher", errorText: _isNotValid ? "Check Input before submitting" : null, errorStyle: TextStyle( decorationColor: Colors.deepOrange, letterSpacing: 2.0)), onChanged: (inputText) { setState(() { // Check Input Validation if (inputText.contains( new RegExp(r'[A-Z]', caseSensitive: false)) && inputText.length > 3) { _isNotValid = false; } else { _isNotValid = true; } }); }, //onChanged is called whenever we add or delete something on Text Field )), Padding( padding: EdgeInsets.all(20.0), child: RaisedButton( color: Theme.of(context).accentColor, elevation: 4.0, splashColor: Colors.white, onPressed: () { Navigator.of(context).pushNamed('/thank_you'); }, child: Text('Next'), )) ], ), ), ), ); } }
0
mirrored_repositories/Fise/lib
mirrored_repositories/Fise/lib/surveys/survey_1.dart
import 'package:flutter/material.dart'; import '../main.dart'; import '../utils/constants.dart'; class HouseholdSurvey extends StatefulWidget { @override _HouseholdSurveyState createState() => _HouseholdSurveyState(); } class _HouseholdSurveyState extends State<HouseholdSurvey> { // state variable int _radiovalue = 0; void _handleRadioValueChange(int value) { setState(() { _radiovalue = value; }); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(TITLES['household']), elevation: 4.0, ), body: Center( child: Card( shape: BeveledRectangleBorder(), child: Padding( padding: EdgeInsets.all(30.0), child: Column(children: <Widget>[ Text('Select one of the following:', style: TextStyle( fontSize: 20.0, fontWeight: FontWeight.bold, )), Container( child: Padding( padding: EdgeInsets.all(20.0), child: Text( 'Your Household Income Bracket is between :', style: TextStyle( fontWeight: FontWeight.normal, fontSize: 18.0, ), textAlign: TextAlign.center, ))), Radio( value: 0, groupValue: _radiovalue, onChanged: _handleRadioValueChange, ), Text( '0 - 30,000', style: TextStyle(fontSize: 16.0), ), Radio( value: 1, groupValue: _radiovalue, onChanged: _handleRadioValueChange, ), Text( '30,001 - 80,000', style: TextStyle(fontSize: 16.0), ), Radio( value: 2, groupValue: _radiovalue, onChanged: _handleRadioValueChange, ), Text( '80,001 - 150,000', style: TextStyle(fontSize: 16.0), ), Radio( value: 3, groupValue: _radiovalue, onChanged: _handleRadioValueChange, ), Text( '150,001 - 300,000', style: TextStyle(fontSize: 16.0), ), Radio( value: 3, groupValue: _radiovalue, onChanged: _handleRadioValueChange, ), Text( '300,001 and above', style: TextStyle(fontSize: 16.0), ), Padding( padding: EdgeInsets.all(20.0), child: RaisedButton( color: Theme.of(context).accentColor, elevation: 4.0, splashColor: Colors.white, onPressed: () { Navigator.of(context).pushNamed('/savings'); }, child: Text('Next'), )) ]))), )); } }
0
mirrored_repositories/Fise/lib
mirrored_repositories/Fise/lib/surveys/survey_5.dart
import 'package:flutter/material.dart'; import '../main.dart'; import '../utils/constants.dart'; class SpendingSurvey extends StatefulWidget { @override _SpendingState createState() => _SpendingState(); } //State is information of the application that can change over time or when some actions are taken. class _SpendingState extends State<SpendingSurvey> { bool _value1 = false; bool _value2 = false; bool _value3 = false; bool _value4 = false; bool _value5 = false; void disableNoneCheckBox() { if (_value5) { _value5 = false; } } void _value1Changed(bool value) => setState(() { disableNoneCheckBox(); _value1 = value; }); void _value2Changed(bool value) => setState(() { disableNoneCheckBox(); _value2 = value; }); void _value3Changed(bool value) => setState(() { disableNoneCheckBox(); _value3 = value; }); void _value4Changed(bool value) => setState(() { disableNoneCheckBox(); _value4 = value; }); void _value5Changed(bool value) { setState(() { if (value) { _value1 = false; _value2 = false; _value3 = false; _value4 = false; } _value5 = value; }); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(TITLES['spending']), ), body: Container( padding: EdgeInsets.all(32.0), child: Center( child: Column( children: <Widget>[ Center( child: Padding( padding: EdgeInsets.all(20.0), child: Text( 'Which of the following would you consider a necessity', style: TextStyle( fontWeight: FontWeight.normal, fontSize: 18.0, ), textAlign: TextAlign.center, ))), CheckboxListTile( value: _value1, onChanged: _value1Changed, title: Text('Mobile Phone'), controlAffinity: ListTileControlAffinity.leading, activeColor: Colors.deepOrange, ), CheckboxListTile( value: _value2, onChanged: _value2Changed, title: Text('Laptop/PC'), controlAffinity: ListTileControlAffinity.leading, activeColor: Colors.deepOrange, ), CheckboxListTile( value: _value3, onChanged: _value3Changed, title: Text('Vaccation'), controlAffinity: ListTileControlAffinity.leading, activeColor: Colors.deepOrange, ), CheckboxListTile( value: _value4, onChanged: _value4Changed, title: Text('Car'), controlAffinity: ListTileControlAffinity.leading, activeColor: Colors.deepOrange, ), CheckboxListTile( value: _value5, onChanged: _value5Changed, title: Text('None'), controlAffinity: ListTileControlAffinity.leading, activeColor: Colors.deepOrange, ), RaisedButton( color: Theme.of(context).accentColor, elevation: 4.0, splashColor: Colors.white, onPressed: () { Navigator.of(context).pushNamed('/occupation'); }, child: Text('Next'), ) ], ), ), ), ); } }
0
mirrored_repositories/Fise/lib
mirrored_repositories/Fise/lib/surveys/survey_4.dart
import 'package:flutter/material.dart'; import '../main.dart'; import '../utils/constants.dart'; class FinanceKnowledgeSurvey extends StatefulWidget { @override _FinanceKnowledgeState createState() => _FinanceKnowledgeState(); } class _FinanceKnowledgeState extends State<FinanceKnowledgeSurvey> { // state variable int _radiovalue = 0; void _handleRadioValueChange(int value) { setState(() { _radiovalue = value; }); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(TITLES['fin_knowledge']), elevation: 4.0, ), body: Center( child: Card( shape: BeveledRectangleBorder(), child: Padding( padding: EdgeInsets.all(30.0), child: Column(children: <Widget>[ Text('Select one of the following:', style: TextStyle( fontSize: 20.0, fontWeight: FontWeight.bold)), Container( child: Padding( padding: EdgeInsets.all(20.0), child: Text( 'On a scale from A to E, what grade would you give yourself in terms of your knowledge about personal finances?', style: TextStyle( fontWeight: FontWeight.normal, fontSize: 18.0, ), textAlign: TextAlign.center, ))), Center( child: Padding( padding: EdgeInsets.all(20.0), child: Row(children: <Widget>[ Radio( value: 0, groupValue: _radiovalue, onChanged: _handleRadioValueChange, ), Text( 'A', style: TextStyle(fontSize: 16.0), ), Radio( value: 1, groupValue: _radiovalue, onChanged: _handleRadioValueChange, ), Text( 'B', style: TextStyle(fontSize: 16.0), ), Radio( value: 2, groupValue: _radiovalue, onChanged: _handleRadioValueChange, ), Text( 'C', style: TextStyle(fontSize: 16.0), ), Radio( value: 3, groupValue: _radiovalue, onChanged: _handleRadioValueChange, ), Text( 'D', style: TextStyle(fontSize: 16.0), ), Radio( value: 3, groupValue: _radiovalue, onChanged: _handleRadioValueChange, ), Text( 'E', style: TextStyle(fontSize: 16.0), ) ]))), Padding( padding: EdgeInsets.all(20.0), child: RaisedButton( color: Theme.of(context).accentColor, elevation: 4.0, splashColor: Colors.white, onPressed: () { Navigator.of(context).pushNamed('/spending'); }, child: Text('Next'), )) ]))), )); } }
0
mirrored_repositories/Fise/lib
mirrored_repositories/Fise/lib/utils/constants.dart
//Titles for each route const Map<String, String> TITLES = { 'household': 'Household', 'spending': 'Spending', 'income': 'Income', 'saving': 'Saving', 'occupation': 'Occupation', 'fin_knowledge': 'Financial Knowledge', };
0
mirrored_repositories/Fise
mirrored_repositories/Fise/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:fise/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/notes_app
mirrored_repositories/notes_app/lib/main.dart
import 'package:flutter/material.dart'; import 'package:notes_app/screens/home.dart'; void main() { runApp(const MainApp()); } class MainApp extends StatelessWidget { const MainApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( debugShowCheckedModeBanner: false, home: HomeScreen(), ); } }
0
mirrored_repositories/notes_app/lib
mirrored_repositories/notes_app/lib/constants/colors.dart
import 'package:flutter/material.dart'; List<Color> backgroundColors = [ const Color(0xFFCCE5FF), // light blue const Color(0xFFD7F9E9), // pale green const Color(0xFFFFF8E1), // pale yellow const Color(0xFFF5E6CC), // beige const Color(0xFFFFD6D6), // light pink const Color(0xFFE5E5E5), // light grey const Color(0xFFFFF0F0), // pale pink const Color(0xFFE6F9FF), // pale blue const Color(0xFFD4EDDA), // mint green const Color(0xFFFFF3CD), // pale orange ];
0
mirrored_repositories/notes_app/lib
mirrored_repositories/notes_app/lib/models/note.dart
class Note { int id; String title; String content; DateTime modifiedTime; Note({ required this.id, required this.title, required this.content, required this.modifiedTime, }); } List<Note> sampleNotes = [ Note( id: 0, title: 'Ideas for Vacation', content: '1. Visit Grand Canyon\n2. Go on a hot air balloon ride\n3. Try local cuisine\n4. Attend a concert', modifiedTime: DateTime(2023, 2, 1, 12, 34), ), Note( id: 1, title: 'Recipes to Try', content: '1. Chicken Alfredo\n2. Vegan chili\n3. Spaghetti carbonara\n4. Chocolate lava cake', modifiedTime: DateTime(2022, 1, 1, 34, 5), ), Note( id: 2, title: 'Books to Read', content: '1. To Kill a Mockingbird\n2. 1984\n3. The Great Gatsby\n4. The Catcher in the Rye', modifiedTime: DateTime(2023, 3, 1, 19, 5), ), Note( id: 3, title: 'Gift Ideas for Mom', content: '1. Jewelry box\n2. Cookbook\n3. Scarf\n4. Spa day gift card', modifiedTime: DateTime(2023, 1, 4, 16, 53), ), Note( id: 4, title: 'Workout Plan', content: 'Monday:\n- Run 5 miles\n- Yoga class\nTuesday:\n- HIIT circuit training\n- Swimming laps\nWednesday:\n- Rest day\nThursday:\n- Weightlifting\n- Spin class\nFriday:\n- Run 3 miles\n- Pilates class\nSaturday:\n- Hiking\n- Rock climbing', modifiedTime: DateTime(2023, 5, 1, 11, 6), ), Note( id: 5, title: 'Bucket List', content: '1. Travel to Japan\n2. Learn to play the guitar\n3. Write a novel\n4. Run a marathon\n5. Start a business', modifiedTime: DateTime(2023, 1, 6, 13, 9), ), Note( id: 6, title: 'Little pigs', content: "Once upon a time there were three little pigs who set out to seek their fortune.", modifiedTime: DateTime(2023, 3, 7, 11, 12), ), Note( id: 7, title: 'Meeting Notes', content: 'Attendees: John, Mary, David\nAgenda:\n- Budget review\n- Project updates\n- Upcoming events', modifiedTime: DateTime(2023, 2, 1, 15, 14), ), Note( id: 8, title: 'Like Jyaz', content: 'A FREE way to support the channel is to give us a LIKE . It does not cost you but means a lot to us.\nIf you are new here please Subscribe', modifiedTime: DateTime(2022, 1, 1, 34, 5), ), ];
0
mirrored_repositories/notes_app/lib
mirrored_repositories/notes_app/lib/screens/edit.dart
import 'package:flutter/material.dart'; import '../models/note.dart'; class EditScreen extends StatefulWidget { final Note? note; const EditScreen({super.key, this.note}); @override State<EditScreen> createState() => _EditScreenState(); } class _EditScreenState extends State<EditScreen> { TextEditingController _titleController = TextEditingController(); TextEditingController _contentController = TextEditingController(); @override void initState() { // TODO: implement initState if (widget.note != null) { _titleController = TextEditingController(text: widget.note!.title); _contentController = TextEditingController(text: widget.note!.content); } super.initState(); } @override Widget build(BuildContext context) { return SafeArea( child: Scaffold( backgroundColor: Colors.grey.shade900, body: Padding( padding: const EdgeInsets.fromLTRB(16, 4, 16, 0), child: Column(children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ IconButton( onPressed: () { Navigator.pop(context); }, padding: const EdgeInsets.all(0), icon: Container( width: 40, height: 40, decoration: BoxDecoration( color: Colors.grey.shade800.withOpacity(.8), borderRadius: BorderRadius.circular(10)), child: const Icon( Icons.arrow_back_ios_new, color: Colors.white, ), ), ), const Divider(height: 1, color: Colors.white) ], ), Expanded( child: ListView( children: [ TextField( controller: _titleController, style: const TextStyle(color: Colors.white, fontSize: 30), decoration: const InputDecoration( border: InputBorder.none, hintText: 'Title', hintStyle: TextStyle(color: Colors.grey, fontSize: 30)), ), TextField( controller: _contentController, style: const TextStyle( color: Colors.white, ), maxLines: null, decoration: const InputDecoration( border: InputBorder.none, hintText: 'Type something here', hintStyle: TextStyle( color: Colors.grey, )), ), ], )) ]), ), floatingActionButton: FloatingActionButton( onPressed: () { Navigator.pop( context, [_titleController.text, _contentController.text]); }, elevation: 10, backgroundColor: Colors.grey.shade800, child: Icon( Icons.save, color: Colors.grey.shade300, ), ), ), ); } }
0
mirrored_repositories/notes_app/lib
mirrored_repositories/notes_app/lib/screens/home.dart
import 'dart:math'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'package:notes_app/constants/colors.dart'; import 'package:notes_app/screens/edit.dart'; import '../models/note.dart'; class HomeScreen extends StatefulWidget { const HomeScreen({super.key}); @override State<HomeScreen> createState() => _HomeScreenState(); } class _HomeScreenState extends State<HomeScreen> { List<Note> filteredNotes = []; bool sorted = false; @override void initState() { super.initState(); filteredNotes = sampleNotes; } getRandomColor() { Random random = Random(); return backgroundColors[random.nextInt(backgroundColors.length)]; } List<Note> sortNotesByModifiedTime(List<Note> notes) { if (sorted) { notes.sort((a, b) => a.modifiedTime.compareTo(b.modifiedTime)); } else { notes.sort((b, a) => a.modifiedTime.compareTo(b.modifiedTime)); } sorted = !sorted; return notes; } void deleteNote(int index) { setState(() { filteredNotes.removeAt(index); }); } void onSearchTextChanged(String searchText) { setState(() { filteredNotes = sampleNotes .where((note) => note.content.toLowerCase().contains(searchText.toLowerCase()) || note.title.toLowerCase().contains(searchText.toLowerCase())) .toList(); }); } @override Widget build(BuildContext context) { return SafeArea( child: Scaffold( backgroundColor: Colors.grey.shade900, body: Padding( padding: const EdgeInsets.fromLTRB(16.0, 4.0, 16.0, 0), child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ const Text('Notes', style: TextStyle(fontSize: 28, color: Colors.white)), IconButton( onPressed: () { setState(() { filteredNotes = sortNotesByModifiedTime(filteredNotes); }); }, padding: const EdgeInsets.all(0), icon: Container( width: 40, height: 40, decoration: BoxDecoration( color: Colors.grey.shade800.withOpacity(.8), borderRadius: BorderRadius.circular(10), ), child: const Icon(Icons.sort, color: Colors.white), ), ) ], ), const SizedBox(height: 20), TextField( onChanged: onSearchTextChanged, style: const TextStyle( fontSize: 16, color: Colors.white, ), decoration: InputDecoration( contentPadding: const EdgeInsets.symmetric(vertical: 12), hintText: "Search notes ...", hintStyle: const TextStyle(color: Colors.grey), fillColor: Colors.grey.shade800, filled: true, focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(30), borderSide: const BorderSide(color: Colors.transparent), ), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(30), borderSide: const BorderSide(color: Colors.transparent), ), prefixIcon: const Icon( Icons.search, color: Colors.grey, ), ), ), const SizedBox(height: 20), Expanded( child: ListView.builder( itemCount: filteredNotes.length, itemBuilder: (BuildContext context, int index) { return Card( color: getRandomColor(), elevation: 3, margin: const EdgeInsets.only(bottom: 20), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), ), child: Padding( padding: const EdgeInsets.all(10.0), child: ListTile( title: RichText( maxLines: 3, overflow: TextOverflow.ellipsis, text: TextSpan( text: '${filteredNotes[index].title} \n', style: const TextStyle( color: Colors.black, fontWeight: FontWeight.bold, fontSize: 18, height: 1.5), children: [ TextSpan( text: filteredNotes[index].content, style: const TextStyle( color: Colors.black, fontWeight: FontWeight.normal, fontSize: 14, height: 1.5)) ]), ), subtitle: Padding( padding: const EdgeInsets.only(top: 8.0), child: Text( 'Edited: ${DateFormat('EEE MMM d, yyy h:mm a').format(sampleNotes[index].modifiedTime)}', style: TextStyle( fontSize: 10, fontStyle: FontStyle.italic, color: Colors.grey.shade800, ), ), ), trailing: IconButton( onPressed: () async { final result = await confirmDialog(context); if (result != null && result) { deleteNote(index); } }, icon: const Icon(Icons.delete), ), ), ), ); }, ), ) ], ), ), floatingActionButton: FloatingActionButton( onPressed: () async { final result = await Navigator.push( context, MaterialPageRoute( builder: (BuildContext context) => const EditScreen(), ), ); if (result != null) { setState(() { sampleNotes.add(Note( id: sampleNotes.length, title: result[0], content: result[1], modifiedTime: DateTime.now())); filteredNotes = sampleNotes; }); } }, elevation: 10, backgroundColor: Colors.grey.shade800, child: Icon( color: Colors.grey.shade300, Icons.add, size: 38, ), ), ), ); } Future<dynamic> confirmDialog(BuildContext context) { return showDialog( context: context, builder: (BuildContext context) { return AlertDialog( backgroundColor: Colors.grey.shade900, icon: const Icon( Icons.info, color: Colors.grey, ), title: const Text( 'Are you sure you want to delete?', style: TextStyle(color: Colors.white), ), content: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ ElevatedButton( onPressed: () { Navigator.pop(context, true); }, style: ElevatedButton.styleFrom(backgroundColor: Colors.green), child: const SizedBox( width: 60, child: Text( 'Yes', textAlign: TextAlign.center, style: TextStyle(color: Colors.white), ), ), ), ElevatedButton( onPressed: () { Navigator.pop(context, false); }, style: ElevatedButton.styleFrom(backgroundColor: Colors.red), child: const SizedBox( width: 60, child: Text( 'No', textAlign: TextAlign.center, style: TextStyle(color: Colors.white), ), ), ), ], ), ); }, ); } }
0
mirrored_repositories/notes_app
mirrored_repositories/notes_app/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct.
0
mirrored_repositories/Search-App-
mirrored_repositories/Search-App-/lib/colors.dart
import 'package:flutter/material.dart'; const backgroundColor = Color.fromRGBO(32, 33, 36, 1); const searchColor = Color.fromRGBO(48, 49, 52, 1); const blueColor = Color.fromRGBO(138, 180, 248, 1); const searchBorder = Color.fromRGBO(95, 99, 104, 1); const primaryColor = Colors.white; const footerColor = Color.fromRGBO(23, 23, 23, 1);
0
mirrored_repositories/Search-App-
mirrored_repositories/Search-App-/lib/main.dart
import 'package:flutter/material.dart'; import 'package:google_clone/colors.dart'; import 'package:google_clone/responsive/mobile_screen_layout.dart'; import 'package:google_clone/responsive/responsive_layout.dart'; import 'package:google_clone/responsive/web_screen_layout.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, title: 'Search Engine', theme: ThemeData.dark().copyWith( scaffoldBackgroundColor: backgroundColor, ), home: const ResponsiveLayout( mobileScreenLayout: MobileScreenLayout(), webScreenLayout: WebScreenLayout(), ), ); } }
0
mirrored_repositories/Search-App-/lib
mirrored_repositories/Search-App-/lib/widgets/footer_text.dart
import 'package:flutter/material.dart'; // main screen footer class FooterText extends StatelessWidget { final String title; const FooterText({ Key? key, required this.title, }) : super(key: key); @override Widget build(BuildContext context) { return TextButton( onPressed: () {}, child: Text( title, style: const TextStyle( color: Color(0xff70757a), ), ), ); } }
0
mirrored_repositories/Search-App-/lib
mirrored_repositories/Search-App-/lib/widgets/translation_buttons.dart
import 'package:flutter/material.dart'; import 'package:google_clone/widgets/language_text.dart'; class TranslationButtons extends StatelessWidget { const TranslationButtons({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Wrap( alignment: WrapAlignment.center, children: const [ Text('Google offered in:'), SizedBox(width: 5), LanguageText(title: 'हिन्दी'), SizedBox(width: 5), LanguageText(title: 'বাংলা'), SizedBox(width: 5), LanguageText(title: 'తెలుగు'), SizedBox(width: 5), LanguageText(title: 'मराठी'), SizedBox(width: 5), LanguageText(title: 'தமிழ்'), SizedBox(width: 5), LanguageText(title: 'ગુજરાતી'), SizedBox(width: 5), LanguageText(title: 'ಕನ್ನಡ'), SizedBox(width: 5), LanguageText(title: 'മലയാളം'), SizedBox(width: 5), LanguageText(title: 'ਪੰਜਾਬੀ'), ], ); } }
0
mirrored_repositories/Search-App-/lib
mirrored_repositories/Search-App-/lib/widgets/search_tabs.dart
import 'package:flutter/material.dart'; import 'package:google_clone/widgets/search_tab.dart'; class SearchTabs extends StatelessWidget { const SearchTabs({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return SizedBox( height: 55, child: Row( crossAxisAlignment: CrossAxisAlignment.end, children: const [ SearchTab( isActive: true, text: 'All', icon: Icons.search, ), SizedBox(width: 20), SearchTab( text: 'Images', icon: Icons.image, ), SizedBox(width: 20), SearchTab( text: 'Maps', icon: Icons.map, ), SizedBox(width: 20), SearchTab( text: 'News', icon: Icons.article, ), SizedBox(width: 20), SearchTab( text: 'Shopping', icon: Icons.shop, ), SizedBox(width: 20), SearchTab( text: 'More', icon: Icons.more_vert, ), ], ), ); } }
0
mirrored_repositories/Search-App-/lib
mirrored_repositories/Search-App-/lib/widgets/language_text.dart
import 'package:flutter/material.dart'; import 'package:google_clone/colors.dart'; // text to show the translation buttons like hindi etc etc class LanguageText extends StatelessWidget { final String title; const LanguageText({ Key? key, required this.title, }) : super(key: key); @override Widget build(BuildContext context) { return InkWell( onTap: () {}, child: Text( title, style: const TextStyle( color: blueColor, ), ), ); } }
0
mirrored_repositories/Search-App-/lib
mirrored_repositories/Search-App-/lib/widgets/search_footer.dart
import 'package:flutter/material.dart'; import 'package:google_clone/colors.dart'; // footer to show when the search results are showing class SearchFooter extends StatelessWidget { const SearchFooter({Key? key}) : super(key: key); @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; return Column( children: [ Container( color: footerColor, padding: EdgeInsets.symmetric( horizontal: size.width <= 768 ? 10 : 150, vertical: 15), child: // first showing the location Row( children: [ Text( 'India', style: TextStyle( color: Colors.grey[700], fontSize: 15, ), ), const SizedBox(width: 10), Container( height: 20, width: 0.5, color: Colors.grey, ), const SizedBox(width: 10), const Icon( Icons.circle, color: Color(0xFF70757A), size: 12, ), const SizedBox(width: 10), const Text( "100016, Mumbai, Maharashtra", style: TextStyle( fontSize: 14, color: primaryColor, ), ), ], ), ), const Divider( thickness: 0, height: 0, color: Colors.black26, ), // showing the help options Container( color: footerColor, padding: EdgeInsets.symmetric(horizontal: size.width <= 768 ? 20 : 50), child: Row( children: [ Text( 'Help', style: TextStyle( color: Colors.grey[700], fontSize: 15, ), ), const SizedBox(width: 20), Text( 'Send feedback', style: TextStyle( color: Colors.grey[700], fontSize: 15, ), ), const SizedBox(width: 20), Text( 'Privacy', style: TextStyle( color: Colors.grey[700], fontSize: 15, ), ), const SizedBox(width: 20), Text( 'Terms', style: TextStyle( color: Colors.grey[700], fontSize: 15, ), ), ], ), ), ], ); } }
0
mirrored_repositories/Search-App-/lib
mirrored_repositories/Search-App-/lib/widgets/search_result_component.dart
import 'package:flutter/material.dart'; import 'package:google_clone/colors.dart'; import 'package:google_clone/widgets/link_text.dart'; import 'package:url_launcher/url_launcher.dart'; class SearchResultComponent extends StatelessWidget { final String linkToGo; final String link; final String text; final String desc; const SearchResultComponent({ Key? key, required this.linkToGo, required this.link, required this.text, required this.desc, }) : super(key: key); @override Widget build(BuildContext context) { return Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ // showing the link at the top first Text( link, ), // showing the text to display as header with link Padding( padding: const EdgeInsets.only(bottom: 8.0), child: LinkText( link: link, text: text, textStyle: const TextStyle( color: blueColor, fontSize: 20, ), onTap: () async { if (await canLaunch(linkToGo)) { await launch(linkToGo); } }, ), ), // showing the meta data or the description of the wbesite Text( desc, style: const TextStyle( fontSize: 14, color: primaryColor, ), ), ], ); } }
0
mirrored_repositories/Search-App-/lib
mirrored_repositories/Search-App-/lib/widgets/signin_button.dart
import 'package:flutter/material.dart'; // sign in button showing up in both the screens- search and main class SigninButton extends StatelessWidget { const SigninButton({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.symmetric(vertical: 10).copyWith( right: 10, ), child: MaterialButton( onPressed: () {}, color: const Color(0xff1A73EB), child: const Text( 'Sign in', style: TextStyle(color: Colors.white), ), ), ); } }
0
mirrored_repositories/Search-App-/lib
mirrored_repositories/Search-App-/lib/widgets/link_text.dart
import 'package:flutter/material.dart'; // displays the title and link of the search results class LinkText extends StatefulWidget { final String link; final String text; final Function()? onTap; final TextStyle? textStyle; const LinkText( {Key? key, required this.link, required this.text, this.onTap, this.textStyle}) : super(key: key); @override _LinkTextState createState() => _LinkTextState(); } class _LinkTextState extends State<LinkText> { bool _showUnderLine = false; @override Widget build(BuildContext context) { return InkWell( splashColor: Colors.transparent, highlightColor: Colors.transparent, hoverColor: Colors.transparent, onTap: widget.onTap, onHover: (hovering) { setState(() { _showUnderLine = hovering; }); }, child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( widget.link, style: const TextStyle(fontSize: 14, color: Color(0xFF202124),), ), Text( widget.text, style: widget.textStyle != null ? widget.textStyle?.copyWith( decoration: _showUnderLine ? TextDecoration.underline : TextDecoration.none) : TextStyle( color: const Color(0xFF1a0dab), fontWeight: FontWeight.w400, fontSize: 20, decoration: _showUnderLine ? TextDecoration.underline : TextDecoration.none, ), ), ], ), ); } }
0
mirrored_repositories/Search-App-/lib
mirrored_repositories/Search-App-/lib/widgets/search_tab.dart
import 'package:flutter/material.dart'; import 'package:google_clone/colors.dart'; class SearchTab extends StatelessWidget { final bool? isActive; final String text; final IconData icon; const SearchTab({ Key? key, required this.text, required this.icon, this.isActive = false, }) : super(key: key); @override Widget build(BuildContext context) { return Column( mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.center, children: [ Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Icon( icon, size: 18, color: isActive!? blueColor : Colors.grey, ), const SizedBox(width: 3), Text( text, style: TextStyle( fontSize: 15, color: isActive!? blueColor : Colors.grey, ), ), ], ), const SizedBox(height: 7), isActive!? Container( height: 3, width: 40, color: blueColor, ): Container(), ], ); } }
0
mirrored_repositories/Search-App-/lib/widgets
mirrored_repositories/Search-App-/lib/widgets/mobile/mobile_footer.dart
import 'package:flutter/material.dart'; import 'package:google_clone/widgets/footer_text.dart'; class MobileFooter extends StatelessWidget { const MobileFooter({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Wrap( children: const [ FooterText(title: 'About'), SizedBox(width: 10), FooterText(title: 'Advertising'), SizedBox(width: 10), FooterText(title: 'Business'), SizedBox(width: 10), FooterText(title: 'How Search Works'), SizedBox(width: 10), FooterText(title: 'Privacy'), SizedBox(width: 10), FooterText(title: 'Terms'), SizedBox(width: 10), FooterText(title: 'Settings'), ], ); } }
0
mirrored_repositories/Search-App-/lib/widgets
mirrored_repositories/Search-App-/lib/widgets/web/web_search_header.dart
import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:google_clone/colors.dart'; import 'package:google_clone/screens/search_screen.dart'; class WebSearchHeader extends StatelessWidget { const WebSearchHeader({Key? key}) : super(key: key); @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; return Padding( padding: const EdgeInsets.only(top: 25.0), child: Row( children: [ Padding( padding: const EdgeInsets.only(left: 28.0, right: 15, top: 4), child: Image.asset( 'assets/images/google-logo.png', height: 30, width: 92, ), ), const SizedBox(width: 27), Container( width: size.width * 0.45, decoration: BoxDecoration( color: searchColor, borderRadius: BorderRadius.circular(22), border: Border.all( color: searchColor, ), ), height: 44, child: TextField( onSubmitted: (text) { if (text.trim() != "") { Navigator.of(context).push( MaterialPageRoute( builder: (context) => SearchScreen( searchQuery: text.trim(), ), ), ); } }, style: const TextStyle(fontSize: 16), textAlignVertical: TextAlignVertical.center, decoration: InputDecoration( suffixIcon: Padding( padding: const EdgeInsets.symmetric(horizontal: 15), child: Container( constraints: const BoxConstraints(maxWidth: 150), child: Row( mainAxisAlignment: MainAxisAlignment.end, mainAxisSize: MainAxisSize.min, children: [ SvgPicture.asset( 'assets/images/mic-icon.svg', height: 20, width: 20, ), const SizedBox(width: 20), const Icon( Icons.search, color: blueColor, ), ], ), ), ), focusedBorder: InputBorder.none, enabledBorder: InputBorder.none, ), ), ), ], ), ); } }
0
mirrored_repositories/Search-App-/lib/widgets
mirrored_repositories/Search-App-/lib/widgets/web/web_footer.dart
import 'package:flutter/material.dart'; import 'package:google_clone/colors.dart'; import 'package:google_clone/widgets/footer_text.dart'; // showing the footer on main screen class WebFooter extends StatelessWidget { const WebFooter({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Container( color: footerColor, child: Padding( padding: const EdgeInsets.all(5), child: Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: const [ FooterText(title: 'About'), SizedBox(width: 10), FooterText(title: 'Advertising'), SizedBox(width: 10), FooterText(title: 'Business'), SizedBox(width: 10), FooterText(title: 'How Search Works'), ], ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: const [ FooterText(title: 'Privacy'), SizedBox(width: 10), FooterText(title: 'Terms'), SizedBox(width: 10), FooterText(title: 'Settings'), ], ), ], ), ), ); } }
0
mirrored_repositories/Search-App-/lib/widgets
mirrored_repositories/Search-App-/lib/widgets/web/search_buttons.dart
import 'package:flutter/material.dart'; import 'package:google_clone/widgets/web/search_button.dart'; class SearchButtons extends StatelessWidget { const SearchButtons({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: const [ SearchButton(title: 'Google Search'), SizedBox(width: 10), SearchButton(title: "I'm Feeling Lucky"), ], ), ], ); } }
0
mirrored_repositories/Search-App-/lib/widgets
mirrored_repositories/Search-App-/lib/widgets/web/web_search.dart
import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:google_clone/colors.dart'; import 'package:google_clone/screens/search_screen.dart'; class Search extends StatelessWidget { const Search({Key? key}) : super(key: key); @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; return SingleChildScrollView( child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [ Center( child: Image.asset( 'assets/images/google-logo.png', height: size.height * 0.12, ), ), const SizedBox(height: 20), SizedBox( // another way of doing things // also everything in search bar is same except this width so just use this width: size.width > 768 ? size.width * 0.4 : size.width * 0.9, child: TextFormField( keyboardType: TextInputType.text, decoration: InputDecoration( border: const OutlineInputBorder( borderSide: BorderSide(color: searchBorder), borderRadius: BorderRadius.all( Radius.circular(30), ), ), prefixIcon: Padding( padding: const EdgeInsets.all(8.0), child: SvgPicture.asset( 'assets/images/search-icon.svg', color: searchBorder, width: 1, height: 1, ), ), suffixIcon: Padding( padding: const EdgeInsets.all(8), child: SvgPicture.asset( 'assets/images/mic-icon.svg', ), ), ), onFieldSubmitted: (val) { if (val != "") { Navigator.of(context).push( MaterialPageRoute( builder: (context) => SearchScreen( searchQuery: val.trim(), ), ), ); } }, ), ), const SizedBox(height: 20), ], ), ); } }
0
mirrored_repositories/Search-App-/lib/widgets
mirrored_repositories/Search-App-/lib/widgets/web/search_button.dart
import 'package:flutter/material.dart'; import 'package:google_clone/colors.dart'; // button to show search and im feeling lucky button class SearchButton extends StatelessWidget { final String title; const SearchButton({ Key? key, required this.title, }) : super(key: key); @override Widget build(BuildContext context) { return MaterialButton( elevation: 0, shape: const RoundedRectangleBorder( borderRadius: BorderRadius.all( Radius.circular(4), ), ), padding: const EdgeInsets.symmetric( horizontal: 25, vertical: 18, ), color: searchColor, onPressed: () {}, child: Text( title, ), ); } }
0
mirrored_repositories/Search-App-/lib
mirrored_repositories/Search-App-/lib/responsive/responsive_layout.dart
import 'package:flutter/material.dart'; class ResponsiveLayout extends StatelessWidget { final Widget mobileScreenLayout; final Widget webScreenLayout; const ResponsiveLayout({Key? key, required this.mobileScreenLayout, required this.webScreenLayout}) : super(key: key); @override Widget build(BuildContext context) { return LayoutBuilder( builder: (context, constraints) { if(constraints.maxWidth <= 767) { return mobileScreenLayout; } return webScreenLayout; }, ); } }
0
mirrored_repositories/Search-App-/lib
mirrored_repositories/Search-App-/lib/responsive/web_screen_layout.dart
import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:google_clone/colors.dart'; import 'package:google_clone/widgets/web/web_search.dart'; import 'package:google_clone/widgets/translation_buttons.dart'; import 'package:google_clone/widgets/web/search_buttons.dart'; import 'package:google_clone/widgets/web/web_footer.dart'; class WebScreenLayout extends StatelessWidget { const WebScreenLayout({Key? key}) : super(key: key); @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; return SafeArea( child: Scaffold( appBar: AppBar( backgroundColor: backgroundColor, elevation: 0, actions: [ TextButton( onPressed: () {}, child: const Text( 'Gmail', style: TextStyle( color: primaryColor, fontWeight: FontWeight.w400, ), ), ), TextButton( onPressed: () {}, child: const Text( 'Images', style: TextStyle( color: primaryColor, fontWeight: FontWeight.w400, ), ), ), const SizedBox(width: 10), IconButton( icon: SvgPicture.asset('assets/images/more-apps.svg', color: primaryColor), onPressed: () {}), const SizedBox(width: 10), Padding( padding: const EdgeInsets.symmetric(vertical: 10).copyWith(right: 10,), child: MaterialButton( onPressed: () {}, color: const Color(0xff1A73EB), child: const Text( 'Sign in', style: TextStyle(color: Colors.white), ), ), ) ], ), body: Padding( padding: const EdgeInsets.only(left: 5, right: 5), child: Column( children: [ SizedBox(height: size.height * 0.25), Expanded( child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ // since children of column are not supposed to be 'spaced between' Column( children: const [ Search(), SizedBox(height: 20), SearchButtons(), SizedBox(height: 20), TranslationButtons(), ], ), const WebFooter(), ], ), ), ], ), ), ), ); } }
0
mirrored_repositories/Search-App-/lib
mirrored_repositories/Search-App-/lib/responsive/mobile_screen_layout.dart
import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:google_clone/colors.dart'; import 'package:google_clone/widgets/mobile/mobile_footer.dart'; import 'package:google_clone/widgets/signin_button.dart'; import 'package:google_clone/widgets/translation_buttons.dart'; import 'package:google_clone/widgets/web/web_search.dart'; class MobileScreenLayout extends StatelessWidget { const MobileScreenLayout({Key? key}) : super(key: key); @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; return Scaffold( appBar: AppBar( backgroundColor: backgroundColor, elevation: 0, leading: IconButton( icon: const Icon( Icons.menu, color: Colors.grey, ), onPressed: () {}, ), title: SizedBox( width: size.width * 0.34, child: const DefaultTabController( length: 2, child: TabBar( labelColor: blueColor, unselectedLabelColor: Colors.grey, indicatorColor: blueColor, tabs: [ Tab(text: 'ALL'), Tab(text: 'IMAGES'), ], ), ), ), actions: [ IconButton( icon: SvgPicture.asset( 'assets/images/more-apps.svg', color: primaryColor, ), onPressed: () {}), const SizedBox(width: 10), const SigninButton(), ], ), body: Padding( padding: const EdgeInsets.only(left: 5, right: 5), child: Column( children: [ SizedBox(height: size.height * 0.25), Expanded( child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( children: const [ Search(), SizedBox(height: 20), TranslationButtons(), ], ), const MobileFooter(), ], ), ), ], ), ), ); } }
0
mirrored_repositories/Search-App-/lib
mirrored_repositories/Search-App-/lib/config/api_json.dart
final Map<String, dynamic> apiResponse = { "kind": "customsearch#search", "url": { "type": "application/json", "template": "https://www.googleapis.com/customsearch/v1?q={searchTerms}&num={count?}&start={startIndex?}&lr={language?}&safe={safe?}&cx={cx?}&sort={sort?}&filter={filter?}&gl={gl?}&cr={cr?}&googlehost={googleHost?}&c2coff={disableCnTwTranslation?}&hq={hq?}&hl={hl?}&siteSearch={siteSearch?}&siteSearchFilter={siteSearchFilter?}&exactTerms={exactTerms?}&excludeTerms={excludeTerms?}&linkSite={linkSite?}&orTerms={orTerms?}&relatedSite={relatedSite?}&dateRestrict={dateRestrict?}&lowRange={lowRange?}&highRange={highRange?}&searchType={searchType}&fileType={fileType?}&rights={rights?}&imgSize={imgSize?}&imgType={imgType?}&imgColorType={imgColorType?}&imgDominantColor={imgDominantColor?}&alt=json" }, "queries": { "request": [ { "title": "Google Cfustom Search - cars", "totalResults": "267000000", "searchTerms": "cars", "count": 10, "startIndex": 1, "inputEncoding": "utf8", "outputEncoding": "utf8", "safe": "off", "cx": "d21ad4f662659e3f8" } ], "nextPage": [ { "title": "Google Custom Search - cars", "totalResults": "267000000", "searchTerms": "cars", "count": 10, "startIndex": 11, "inputEncoding": "utf8", "outputEncoding": "utf8", "safe": "off", "cx": "d21ad4f662659e3f8" } ] }, "context": {"title": "Google"}, "searchInformation": { "searchTime": 0.643615, "formattedSearchTime": "0.64", "totalResults": "267000000", "formattedTotalResults": "267,000,000" }, "items": [ { "kind": "customsearch#result", "title": "Waymo", "htmlTitle": "Waymo", "link": "https://www.google.com/selfdrivingcar/", "displayLink": "www.google.com", "snippet": "Waymo—formerly the Google self-driving car project—stands for a new way \nforward in mobility. Our mission is to make it safe and easy for people and things \nto ...", "htmlSnippet": "Waymo—formerly the Google self-driving \u003cb\u003ecar\u003c/b\u003e project—stands for a new way \u003cbr\u003e\nforward in mobility. Our mission is to make it safe and easy for people and things \u003cbr\u003e\nto&nbsp;...", "cacheId": "jH6OCbvTOPQJ", "formattedUrl": "https://www.google.com/selfdrivingcar/", "htmlFormattedUrl": "https://www.google.com/selfdriving\u003cb\u003ecar\u003c/b\u003e/", "pagemap": { "cse_thumbnail": [ { "src": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcQDe3q_ecCo3327WH9qZ7L8ws21NE7bS3jFwMQ03gCBs4uCnT6WVePFQPA", "width": "310", "height": "163" } ], "metatags": [ { "og:image": "https://waymo.com/v2/static/images/waymo_banner.jpg", "og:type": "website", "twitter:card": "summary_large_image", "twitter:title": "Waymo", // Generated by https://quicktype.io "og:site_name": "Waymo", "og:title": "Waymo", "og:description": "Waymo—formerly the Google self-driving car project—stands for a new way forward in mobility. Our mission is to make it safe and easy for people and things to move around.", "twitter:creator": "@Waymo", "og:image:secure_url": "https://waymo.com/v2/static/images/waymo_banner.jpg", "twitter:image": "https://waymo.com/v2/static/images/waymo_banner.jpg", "referrer": "no-referrer", "twitter:site": "@Waymo", "viewport": "width=device-width, initial-scale=1.0", "twitter:description": "Waymo—formerly the Google self-driving car project—stands for a new way forward in mobility. Our mission is to make it safe and easy for people and things to move around.", "og:locale": "en", "og:url": "https://waymo.com/" } ], "cse_image": [ {"src": "https://waymo.com/v2/static/images/waymo_banner.jpg"} ] } }, { "kind": "customsearch#result", "title": "Google Car Search", "htmlTitle": "Google \u003cb\u003eCar\u003c/b\u003e Search", "link": "https://www.google.com/cars/", "displayLink": "www.google.com", "snippet": "Thank you for visiting Google.com/cars. The Google San Francisco Bay Area car \nsearch beta program has been discontinued as we focus on building the next ...", "htmlSnippet": "Thank you for visiting Google.com/\u003cb\u003ecars\u003c/b\u003e. The Google San Francisco Bay Area \u003cb\u003ecar\u003c/b\u003e \u003cbr\u003e\nsearch beta program has been discontinued as we focus on building the next&nbsp;...", "cacheId": "lCvPnLoDD5EJ", "formattedUrl": "https://www.google.com/cars/", "htmlFormattedUrl": "https://www.google.com/\u003cb\u003ecars\u003c/b\u003e/", "pagemap": { "metatags": [ {"viewport": "initial-scale=1, minimum-scale=1, width=device-width"} ] } }, { "kind": "customsearch#result", "title": "Send to Car Settings", "htmlTitle": "Send to \u003cb\u003eCar\u003c/b\u003e Settings", "link": "https://www.google.com/maps/sendtocar", "displayLink": "www.google.com", "snippet": "Send locations from Google to your car. Send addresses, businesses, and \ndirections from Google Maps to your Send to Car enabled vehicle or GPS device.", "htmlSnippet": "Send locations from Google to your \u003cb\u003ecar\u003c/b\u003e. Send addresses, businesses, and \u003cbr\u003e\ndirections from Google Maps to your Send to \u003cb\u003eCar\u003c/b\u003e enabled vehicle or GPS device.", "cacheId": "oObUH4fVm04J", "formattedUrl": "https://www.google.com/maps/sendtocar", "htmlFormattedUrl": "https://www.google.com/maps/sendto\u003cb\u003ecar\u003c/b\u003e" }, { "kind": "customsearch#result", "title": "Cars.com, 300 S Riverside Plaza #1100, Chicago, IL, 60606, us ...", "htmlTitle": "\u003cb\u003eCars\u003c/b\u003e.com, 300 S Riverside Plaza #1100, Chicago, IL, 60606, us ...", "link": "https://www.google.com/maps/search/?api=1&query=Cars.com%2C+300+S+Riverside+Plaza+%231100%2C+Chicago%2C+IL%2C+60606%2C+us&query_place_id=ChIJv8wv1b0sDogRqn93AOSgVw4", "displayLink": "www.google.com", "snippet": "Cars.com, 300 S Riverside Plaza #1100, Chicago, IL, 60606, us. Your location. \nTrails. Dedicated lanes. Bicycle-friendly roads. Dirt/unpaved trails. Live traffic.", "htmlSnippet": "\u003cb\u003eCars\u003c/b\u003e.com, 300 S Riverside Plaza #1100, Chicago, IL, 60606, us. Your location. \u003cbr\u003e\nTrails. Dedicated lanes. Bicycle-friendly roads. Dirt/unpaved trails. Live traffic.", "cacheId": "xShVQ9sICD0J", "formattedUrl": "https://www.google.com/maps/search/?api=1...Cars...S...", "htmlFormattedUrl": "https://www.google.com/maps/search/?api=1...\u003cb\u003eCars\u003c/b\u003e...S...", "pagemap": { "cse_thumbnail": [ { "src": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQQUDTMfgWSotdHvbOKW4AmY1steqsilnDJS4q33zGx-d0AXvvxPiFY9Mvs", "width": "204", "height": "247" } ], "metatags": [ { "referrer": "origin", "twitter:card": "summary", "theme-color": "#3367D6", "viewport": "initial-scale=1.0, user-scalable=no", "google": "notranslate" } ], "cse_image": [ { "src": "https://maps.gstatic.com/tactile/basepage/pegman_sherlock.png" } ] } }, { "kind": "customsearch#result", "title": "Classic Cars West, 411 26th St, Oakland, CA, 94612, us - Google ...", "htmlTitle": "Classic \u003cb\u003eCars\u003c/b\u003e West, 411 26th St, Oakland, CA, 94612, us - Google ...", "link": "https://www.google.com/maps/search/?api=1&query=Classic+Cars+West%2C+411+26th+St%2C+Oakland%2C+CA%2C+94612%2C+us&query_place_id=ChIJucqhQauAj4ARZPrUnB0y67I", "displayLink": "www.google.com", "snippet": "Classic Cars West, 411 26th St, Oakland, CA, 94612, us. Your location. Trails. \nDedicated lanes. Bicycle-friendly roads. Dirt/unpaved trails. Live traffic. Fast. Slow\n.", "htmlSnippet": "Classic \u003cb\u003eCars\u003c/b\u003e West, 411 26th St, Oakland, CA, 94612, us. Your location. Trails. \u003cbr\u003e\nDedicated lanes. Bicycle-friendly roads. Dirt/unpaved trails. Live traffic. Fast. Slow\u003cbr\u003e\n.", "cacheId": "f7_EDhwOrDgJ", "formattedUrl": "https://www.google.com/maps/search/?api=1...Cars...411...", "htmlFormattedUrl": "https://www.google.com/maps/search/?api=1...\u003cb\u003eCars\u003c/b\u003e...411...", "pagemap": { "cse_thumbnail": [ { "src": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQQUDTMfgWSotdHvbOKW4AmY1steqsilnDJS4q33zGx-d0AXvvxPiFY9Mvs", "width": "204", "height": "247" } ], "metatags": [ { "referrer": "origin", "twitter:card": "summary", "theme-color": "#3367D6", "viewport": "initial-scale=1.0, user-scalable=no", "google": "notranslate" } ], "cse_image": [ { "src": "https://maps.gstatic.com/tactile/basepage/pegman_sherlock.png" } ] } }, { "kind": "customsearch#result", "title": "Street View photos come from two sources, Google and our ...", "htmlTitle": "Street View photos come from two sources, Google and our ...", "link": "https://www.google.com/streetview/explore/", "displayLink": "www.google.com", "snippet": "Where we're headed. We are driving through many countries with the Street View \ncar to bring you imagery that enhances your experience and helps you discover ...", "htmlSnippet": "Where we&#39;re headed. We are driving through many countries with the Street View \u003cbr\u003e\n\u003cb\u003ecar\u003c/b\u003e to bring you imagery that enhances your experience and helps you discover&nbsp;...", "cacheId": "8gJE30ywJMAJ", "formattedUrl": "https://www.google.com/streetview/explore/", "htmlFormattedUrl": "https://www.google.com/streetview/explore/", "pagemap": { "cse_thumbnail": [ { "src": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQX1cLnZUu-Z14c7gxGcW3xIlVMEd3eROiW7M7zCz3JXcLOe_GqP4QDRpvZ", "width": "310", "height": "163" } ], "metatags": [ { "og:image": "https://lh3.googleusercontent.com/3wxVX9CvVROw7gEVATEnkFjrA8OcDsAVapJF30CDDZ9N59CcfiEVJzZKo4bK09csdyMTVBefdasBZemIfjEYOh6lQnS315OmlMCl=s0", "apple-itunes-app": "app-id=904418768", "twitter:title": "Street View photos come from two sources, Google and our contributors.", "twitter:card": "summary", "og:type": "article", "og:site_name": "Google Maps Street View", "og:title": "Street View photos come from two sources, Google and our contributors.", "og:description": "Learn about what Street View is, where we've been, and where we're going. To share Street View imagery, our engineering team is hard at work behind the scenes.", "twitter:image:src": "https://lh3.googleusercontent.com/peyT6rCarwklZzaRyoQV6x0yOxc5VcVDdG6scCjtLfUHs5jgBSuW09vgGkuB0Ij1mXefjB2Fb1cyOksIW6nqxWDd2-chCYvLFz9l=s0", "referrer": "no-referrer", "apple-mobile-web-app-status-bar-style": "black", "twitter:site": "@googlemaps", "viewport": "initial-scale=1, minimum-scale=1, width=device-width", "twitter:description": "Learn about what Street View is, where we've been, and where we're going. To share Street View imagery, our engineering team is hard at work behind the scenes.", "apple-mobile-web-app-capable": "yes" } ], "cse_image": [ { "src": "https://lh3.googleusercontent.com/3wxVX9CvVROw7gEVATEnkFjrA8OcDsAVapJF30CDDZ9N59CcfiEVJzZKo4bK09csdyMTVBefdasBZemIfjEYOh6lQnS315OmlMCl=s0" } ] } }, { "kind": "customsearch#result", "title": "Patent US48799 - Improvement in stake-holders for platform-cars ...", "htmlTitle": "Patent US48799 - Improvement in stake-holders for platform-\u003cb\u003ecars\u003c/b\u003e ...", "link": "http://www.google.com/patents/US48799", "displayLink": "www.google.com", "snippet": "The nature of my said invention consists in a novel mode of attaching and \nsecuring the stake to the side of a platform-car, whereby, while said stake is ...", "htmlSnippet": "The nature of my said invention consists in a novel mode of attaching and \u003cbr\u003e\nsecuring the stake to the side of a platform-\u003cb\u003ecar\u003c/b\u003e, whereby, while said stake is&nbsp;...", "formattedUrl": "www.google.com/patents/US48799", "htmlFormattedUrl": "www.google.com/patents/US48799", "pagemap": { "book": [ { "image": "http://www.google.com/patents?id=&printsec=frontcover&img=1&zoom=1", "name": "Patent US48799 - Improvement in stake-holders for platform-cars", "description": "www.google.com", "url": "http://www.google.com/patents/US48799?utm_source=gb-gplus-share" } ], "metatags": [ { "citation_patent_number": "US:48799", "og:image": "http://www.google.com/patents?id=&printsec=frontcover&img=1&zoom=1", "og:type": "book", "og:site_name": "Google Books", "dc.type": "Patent", "og:title": "Patent US48799 - Improvement in stake-holders for platform-cars", "dc.title": "Improvement in stake-holders for platform-cars", "dc.date": "1865-7-18", "og:url": "http://www.google.com/patents/US48799", "title": "Patent US48799 - Improvement in stake-holders for platform-cars", "dc.contributor": "Edwin A. Eddy" } ], "cse_image": [ { "src": "http://www.google.com/patents?id=&printsec=frontcover&img=1&zoom=1" } ] } }, { "kind": "customsearch#result", "title": "Magic Car Wash Express 2612 Washington Ave, Sheboygan, WI ...", "htmlTitle": "Magic \u003cb\u003eCar\u003c/b\u003e Wash Express 2612 Washington Ave, Sheboygan, WI ...", "link": "https://www.google.com/maps/search/?api=1&query=Magic%20Car%20Wash%20Express%202612%20Washington%20Ave%2C%20Sheboygan%2C%20WI%2053081%2C%20USA&query_place_id=ChIJKcX8Q_emBIgRmehDzYrbn7Q", "displayLink": "www.google.com", "snippet": "Magic Car Wash Express 2612 Washington Ave, Sheboygan, WI 53081, USA. \nYour location. Trails. Dedicated lanes. Bicycle-friendly roads. Dirt/unpaved trails.", "htmlSnippet": "Magic \u003cb\u003eCar\u003c/b\u003e Wash Express 2612 Washington Ave, Sheboygan, WI 53081, USA. \u003cbr\u003e\nYour location. Trails. Dedicated lanes. Bicycle-friendly roads. Dirt/unpaved trails.", "cacheId": "kqlP9js0yi8J", "formattedUrl": "https://www.google.com/.../search/?... Magic%20Car%20Wash%20Express%202612%20Washington%20Ave%2...", "htmlFormattedUrl": "https://www.google.com/.../search/?... Magic%20\u003cb\u003eCar\u003c/b\u003e%20Wash%20Express%202612%20Washington%20Ave%2...", "pagemap": { "cse_thumbnail": [ { "src": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQQUDTMfgWSotdHvbOKW4AmY1steqsilnDJS4q33zGx-d0AXvvxPiFY9Mvs", "width": "204", "height": "247" } ], "metatags": [ { "referrer": "origin", "twitter:card": "summary", "theme-color": "#3367d6", "viewport": "initial-scale=1.0, user-scalable=no", "google": "notranslate" } ], "cse_image": [ { "src": "https://maps.gstatic.com/tactile/basepage/pegman_sherlock.png" } ] } }, { "kind": "customsearch#result", "title": "Google.org brings the best of Google to help solve some of ...", "htmlTitle": "Google.org brings the best of Google to help solve some of ...", "link": "https://www.google.com/giving/", "displayLink": "www.google.com", "snippet": "Learn how Google.org uses the best of Google to help nonprofits and social \nenterprises solve humanity's biggest challenges.", "htmlSnippet": "Learn how Google.org uses the best of Google to help nonprofits and social \u003cbr\u003e\nenterprises solve humanity&#39;s biggest challenges.", "cacheId": "i3IgMGM5SwIJ", "formattedUrl": "https://www.google.com/giving/", "htmlFormattedUrl": "https://www.google.com/giving/", "pagemap": { "cse_thumbnail": [ { "src": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcQHLsk2LGw-p6iYNTPiAUIhF3sekuEn9hpRKNWLPmjb7Ct5RYEBl52STC4", "width": "310", "height": "163" } ], "metatags": [ { "og:image": "https://lh3.googleusercontent.com/1kA4d6Jn-j_5ByaplDmw4MX1-T8lZAWOO7kKop8Mmu1-sA9lnVMN8Bn65KeF9JLVpkxDNdGkHAO8H3RIrO-a3kMRpxIX2pdPqz7U-A=w1200-l80-sg-rj", "og:type": "website", "og:site_name": "Google.org", "viewport": "width=device-width, initial-scale=1", "og:title": "Google.org brings the best of Google to help solve some of humanity’s biggest challenges — combining funding, innovation, and technical expertise to support underserved communities and provide opportunity for everyone.", "og:locale": "root", "og:url": "https://google.org/", "og:description": "Learn how Google.org uses the best of Google to help nonprofits and social enterprises solve humanity’s biggest challenges." } ], "cse_image": [ { "src": "https://lh3.googleusercontent.com/1kA4d6Jn-j_5ByaplDmw4MX1-T8lZAWOO7kKop8Mmu1-sA9lnVMN8Bn65KeF9JLVpkxDNdGkHAO8H3RIrO-a3kMRpxIX2pdPqz7U-A=w1200-l80-sg-rj" } ] } }, { "kind": "customsearch#result", "title": "Grand Prix Car Wash 1295 U.S. Hwy 395 N, Gardnerville, NV 89410 ...", "htmlTitle": "Grand Prix \u003cb\u003eCar\u003c/b\u003e Wash 1295 U.S. Hwy 395 N, Gardnerville, NV 89410 ...", "link": "https://www.google.com/maps/search/?api=1&query=Grand%20Prix%20Car%20Wash%201295%20U.S.%20Hwy%20395%20N%2C%20Gardnerville%2C%20NV%2089410%2C%20USA&query_place_id=ChIJTXR9ko--mYARgqNEakuXA8k", "displayLink": "www.google.com", "snippet": "Grand Prix Car Wash 1295 U.S. Hwy 395 N, Gardnerville, NV 89410, USA. Your \nlocation. Trails. Dedicated lanes. Bicycle-friendly roads. Dirt/unpaved trails.", "htmlSnippet": "Grand Prix \u003cb\u003eCar\u003c/b\u003e Wash 1295 U.S. Hwy 395 N, Gardnerville, NV 89410, USA. Your \u003cbr\u003e\nlocation. Trails. Dedicated lanes. Bicycle-friendly roads. Dirt/unpaved trails.", "cacheId": "ikBVfMiIDK0J", "formattedUrl": "https://www.google.com/.../search/?... Grand%20Prix%20Car%20Wash%201295%20U...", "htmlFormattedUrl": "https://www.google.com/.../search/?... Grand%20Prix%20\u003cb\u003eCar\u003c/b\u003e%20Wash%201295%20U...", "pagemap": { "cse_thumbnail": [ { "src": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQQUDTMfgWSotdHvbOKW4AmY1steqsilnDJS4q33zGx-d0AXvvxPiFY9Mvs", "width": "204", "height": "247" } ], "metatags": [ { "referrer": "origin", "twitter:card": "summary", "theme-color": "#3367D6", "viewport": "initial-scale=1.0, user-scalable=no", "google": "notranslate" } ], "cse_image": [ { "src": "https://maps.gstatic.com/tactile/basepage/pegman_sherlock.png" } ] } } ] };
0
mirrored_repositories/Search-App-/lib
mirrored_repositories/Search-App-/lib/config/api_keys.dart
const String apiKey = "ADD-YOUR-API"; const String contextKey = "ADD-YOUR-CONTEXT-KEY";
0
mirrored_repositories/Search-App-/lib
mirrored_repositories/Search-App-/lib/services/api_service.dart
import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:google_clone/config/api_json.dart'; import 'package:google_clone/config/api_keys.dart'; import 'package:http/http.dart' as http; class ApiService { bool isDummyData = false; Future<Map<String, dynamic>> fetchData( {required BuildContext context, required String queryTerm, String start = "0"}) async { try { if (!isDummyData) { String q = queryTerm.contains(' ')? queryTerm.split(' ').join('%20'): queryTerm; final response = await http.get( Uri.parse( 'https://www.googleapis.com/customsearch/v1?key=$apiKey&cx=$contextKey&q=$q&start=$start'), ); if (response.statusCode == 200) { final jsonData = response.body; final respData = json.decode(jsonData); return respData; } } } catch (e) { print( e.toString(), ); } return apiResponse; } }
0
mirrored_repositories/Search-App-/lib
mirrored_repositories/Search-App-/lib/screens/search_screen.dart
import 'package:flutter/material.dart'; import 'package:google_clone/colors.dart'; import 'package:google_clone/services/api_service.dart'; import 'package:google_clone/widgets/search_footer.dart'; import 'package:google_clone/widgets/web/web_search_header.dart'; import 'package:google_clone/widgets/search_result_component.dart'; import 'package:google_clone/widgets/search_tabs.dart'; class SearchScreen extends StatelessWidget { final String searchQuery; final String start; const SearchScreen({Key? key, required this.searchQuery, this.start = '0'}) : super(key: key); @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; return GestureDetector( onTap: () { FocusScope.of(context).unfocus(); }, child: Title( // for the title of the website color: Colors.blue, // This is required title: searchQuery, child: Scaffold( body: SingleChildScrollView( child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ // for the header part of the website showing search text field const WebSearchHeader(), // for showing ALL, IMAGES, MAPS etc tabs Padding( padding: EdgeInsets.only(left: size.width <= 768 ? 10 : 150.0), child: const SingleChildScrollView( scrollDirection: Axis.horizontal, child: SearchTabs(), ), ), const Divider( height: 0, thickness: 0, ), // showing search results FutureBuilder<Map<String, dynamic>>( future: ApiService().fetchData( context: context, queryTerm: searchQuery, start: start), builder: (context, snapshot) { if (snapshot.hasData) { // return Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ // showing the time it took to fetch results Container( padding: EdgeInsets.only( left: size.width <= 768 ? 10 : 150, top: 12), child: Text( "About ${snapshot.data?['searchInformation']['formattedTotalResults']} results (${snapshot.data?['searchInformation']['formattedSearchTime']} seconds)", style: const TextStyle( fontSize: 15, color: Color(0xFF70757a), ), ), ), // displaying the results ListView.builder( physics: const NeverScrollableScrollPhysics(), shrinkWrap: true, itemCount: snapshot.data?['items'].length, itemBuilder: (context, index) { return Padding( padding: EdgeInsets.only( left: size.width <= 768 ? 10 : 150, top: 10), child: SearchResultComponent( linkToGo: snapshot.data?['items'][index] ['link'], link: snapshot.data?['items'][index] ['formattedUrl'], text: snapshot.data?['items'][index]['title'], desc: snapshot.data?['items'][index] ['snippet'], ), ); }, ), const SizedBox(height: 30), // pagination SizedBox( width: double.infinity, child: Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ TextButton( child: const Text( "< Prev", style: TextStyle( fontSize: 15, color: blueColor, ), ), // if start is 0, we are on the first page onPressed: start != "0" ? () { Navigator.push( context, MaterialPageRoute( builder: (context) => SearchScreen( searchQuery: searchQuery, start: (int.parse(start) - 10) .toString(), ), ), ); } : () {}), const SizedBox(width: 30), TextButton( child: const Text( "Next >", style: TextStyle( fontSize: 15, color: blueColor, ), ), // if start is 0, we are on the first page onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (context) => SearchScreen( searchQuery: searchQuery, start: (int.parse(start) + 10) .toString(), ), ), ); }, ), ], ), ), const SizedBox(height: 30), const SearchFooter(), ], ); } return const Center( child: CircularProgressIndicator(), ); }, ), ], ), ), ), ), ); } }
0
mirrored_repositories/Search-App-
mirrored_repositories/Search-App-/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility 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:google_clone/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/banner_example
mirrored_repositories/banner_example/lib/main.dart
import 'package:banner_example/page/banner_basic_page.dart'; import 'package:banner_example/page/banner_custom_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter/rendering.dart'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); await SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, DeviceOrientation.portraitDown, ]); runApp(MyApp()); } class MyApp extends StatelessWidget { static final String title = 'Banner & Badges'; @override Widget build(BuildContext context) => MaterialApp( debugShowCheckedModeBanner: false, title: title, theme: ThemeData( scaffoldBackgroundColor: Colors.black, primaryColor: Colors.deepOrange, ), home: MainPage(title: title), ); } class MainPage extends StatefulWidget { final String title; const MainPage({ @required this.title, }); @override _MainPageState createState() => _MainPageState(); } class _MainPageState extends State<MainPage> { int index = 0; @override Widget build(BuildContext context) => Scaffold( bottomNavigationBar: buildBottomBar(), body: buildPages(), ); Widget buildBottomBar() { final style = TextStyle(color: Colors.white); return BottomNavigationBar( backgroundColor: Theme.of(context).primaryColor, selectedItemColor: Colors.white, unselectedItemColor: Colors.white70, currentIndex: index, items: [ BottomNavigationBarItem( icon: Text('Banner', style: style), title: Text('Basic'), ), BottomNavigationBarItem( icon: Text('Banner', style: style), title: Text('Custom'), ), ], onTap: (int index) => setState(() => this.index = index), ); } Widget buildPages() { switch (index) { case 0: return BannerBasicPage(); case 1: return BannerCustomPage(); default: return Container(); } } }
0
mirrored_repositories/banner_example/lib
mirrored_repositories/banner_example/lib/page/banner_custom_page.dart
import 'dart:math'; import 'package:banner_example/main.dart'; import 'package:banner_example/widget/card_widget.dart'; import 'package:flutter/material.dart'; class BannerCustomPage extends StatelessWidget { static final topLeft = AlwaysStoppedAnimation(-45 / 360); static final topRight = AlwaysStoppedAnimation(45 / 360); @override Widget build(BuildContext context) => Scaffold( appBar: AppBar( title: Text(MyApp.title), ), body: ListView( physics: BouncingScrollPhysics(), padding: EdgeInsets.all(16), children: [ buildCardTopLeft(), const SizedBox(height: 16), buildCardTopRight(), const SizedBox(height: 16), buildCardBottomLeft(), const SizedBox(height: 16), buildCardBottomRight(), ], ), ); Widget buildCardTopLeft() => Stack( children: <Widget>[ CardWidget(), Positioned( left: -32, top: 20, child: buildBadge(turns: topLeft), ), ], ); Widget buildCardTopRight() => Stack( children: <Widget>[ CardWidget(), Positioned( right: -32, top: 20, child: buildBadge(turns: topRight), ), ], ); Widget buildCardBottomLeft() => Stack( children: <Widget>[ CardWidget(), Positioned( left: -32, bottom: 20, child: buildBadge(turns: topRight), ), ], ); Widget buildCardBottomRight() => Stack( children: <Widget>[ CardWidget(), Positioned( right: -32, bottom: 20, child: buildBadge(turns: topLeft), ), ], ); Widget buildBadge({@required Animation<double> turns}) => RotationTransition( turns: turns, child: Container( padding: EdgeInsets.symmetric(vertical: 8, horizontal: 36), color: Colors.teal, child: Text( 'POPULAR', style: TextStyle(fontWeight: FontWeight.bold, color: Colors.white), ), ), ); } /* import 'dart:math'; import 'package:banner_example/main.dart'; import 'package:banner_example/widget/card_widget.dart'; import 'package:flutter/material.dart'; class BannerCustomPage extends StatelessWidget { static final rotateLeft = AlwaysStoppedAnimation(-45 / 360); static final rotateRight = AlwaysStoppedAnimation(45 / 360); @override Widget build(BuildContext context) => Scaffold( appBar: AppBar( title: Text(MyApp.title), ), body: ListView( physics: BouncingScrollPhysics(), padding: EdgeInsets.all(16), children: [ buildCardTopLeft(), const SizedBox(height: 16), buildCardTopRight(), const SizedBox(height: 16), buildCardBottomLeft(), const SizedBox(height: 16), buildCardBottomRight(), ], ), ); Widget buildCardTopLeft() => Stack( children: <Widget>[ CardWidget(), Positioned( left: -32, top: 20, child: buildBadge(turns: rotateLeft), ), ], ); Widget buildCardTopRight() => Stack( children: <Widget>[ CardWidget(), Positioned( right: -32, top: 20, child: buildBadge(turns: rotateRight), ), ], ); Widget buildCardBottomLeft() => Stack( children: <Widget>[ CardWidget(), Positioned( left: -32, bottom: 20, child: buildBadge(turns: rotateRight), ), ], ); Widget buildCardBottomRight() => Stack( children: <Widget>[ CardWidget(), Positioned( right: -32, bottom: 20, child: buildBadge(turns: rotateLeft), ), ], ); Widget buildBadge({@required Animation<double> turns}) => RotationTransition( turns: turns, child: Container( padding: EdgeInsets.symmetric(vertical: 8, horizontal: 36), color: Colors.teal, child: Text( 'POPULAR', style: TextStyle(fontWeight: FontWeight.bold, color: Colors.white), ), ), ); } */
0
mirrored_repositories/banner_example/lib
mirrored_repositories/banner_example/lib/page/banner_basic_page.dart
import 'package:banner_example/main.dart'; import 'package:banner_example/widget/card_widget.dart'; import 'package:flutter/material.dart'; class BannerBasicPage extends StatelessWidget { @override Widget build(BuildContext context) => Scaffold( appBar: AppBar( title: Text(MyApp.title), ), body: ListView( physics: BouncingScrollPhysics(), padding: EdgeInsets.all(16), children: [ buildBanner(location: BannerLocation.topStart), const SizedBox(height: 16), buildBanner(location: BannerLocation.topEnd), const SizedBox(height: 16), buildBanner(location: BannerLocation.bottomStart), const SizedBox(height: 16), buildBanner(location: BannerLocation.bottomEnd), ], ), ); Widget buildBanner({ @required BannerLocation location, }) => ClipRRect( borderRadius: BorderRadius.circular(20), child: Banner( message: 'TOP', location: location, color: Colors.redAccent, textStyle: TextStyle(fontWeight: FontWeight.bold), child: CardWidget(), ), ); }
0
mirrored_repositories/banner_example/lib
mirrored_repositories/banner_example/lib/widget/card_widget.dart
import 'package:flutter/material.dart'; class CardWidget extends StatelessWidget { @override Widget build(BuildContext context) => ClipRRect( borderRadius: BorderRadius.circular(20), child: Container( height: 250, color: Colors.blueGrey.shade100, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ buildImage(), Spacer(), buildText(), Spacer(), ], ), ), ); Widget buildImage() => Image.network( 'https://images.unsplash.com/photo-1528605248644-14dd04022da1?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80', height: 150, width: double.infinity, fit: BoxFit.cover, ); Widget buildText() => Container( padding: EdgeInsets.symmetric(horizontal: 16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Healthy Eating', style: TextStyle( fontSize: 24, fontWeight: FontWeight.bold), //TextStyle ), const SizedBox(height: 4), Text( 'Italian Dinner Course', style: TextStyle(fontSize: 16), //TextStyle ), ], ), ); }
0
mirrored_repositories/Flutter-Pomodoro-App
mirrored_repositories/Flutter-Pomodoro-App/lib/main.dart
import 'package:flutter/material.dart'; import 'package:pomodoro/screens/home.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { const MyApp({Key key}) : super(key: key); @override Widget build(BuildContext context) { return MaterialApp( home: HomePage(), debugShowCheckedModeBanner: false, theme: ThemeData( primarySwatch: Colors.indigo, accentColor: Colors.red, canvasColor: Color(0xFF111111), textTheme: TextTheme( bodyText1: TextStyle( color: Colors.white, fontFamily: "sans-serif", fontSize: 125, fontWeight: FontWeight.w200), bodyText2: TextStyle( color: Colors.white, fontFamily: "sans-serif", fontSize: 35, fontWeight: FontWeight.normal))), ); } }
0
mirrored_repositories/Flutter-Pomodoro-App/lib
mirrored_repositories/Flutter-Pomodoro-App/lib/widgets/digit.dart
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class AnimatedFlipCounter extends StatelessWidget { final String value; final Duration duration; final double size; final Color color; const AnimatedFlipCounter({ Key key, @required this.value, @required this.duration, this.size = 72, this.color = Colors.black, }) : super(key: key); @override Widget build(BuildContext context) { List<int> digits = []; digits = value.split(":").join("").split("").map((x) => int.parse(x)).toList(); digits = new List.from(digits.reversed); return Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end, children: <Widget>[ _SingleDigitFlipCounter( key: ValueKey(3), value: digits[3].toDouble(), duration: duration, height: size, width: size / 1.8, color: color, ), _SingleDigitFlipCounter( key: ValueKey(2), value: digits[2].toDouble(), duration: duration, height: size, width: size / 1.8, color: color, ), Text( ":", style: Theme.of(context).textTheme.bodyText1, ), _SingleDigitFlipCounter( key: ValueKey(1), value: digits[1].toDouble(), duration: duration, height: size, width: size / 1.8, color: color, ), _SingleDigitFlipCounter( key: ValueKey(0), value: digits[0].toDouble(), duration: duration, height: size, width: size / 1.8, color: color, ), ], ); } } class _SingleDigitFlipCounter extends StatelessWidget { final double value; final Duration duration; final double height; final double width; final Color color; const _SingleDigitFlipCounter({ Key key, @required this.value, @required this.duration, @required this.height, @required this.width, @required this.color, }) : super(key: key); @override Widget build(BuildContext context) { return TweenAnimationBuilder( tween: Tween(begin: value, end: value), duration: duration, builder: (context, value, child) { final whole = value ~/ 1; final decimal = value - whole; return SizedBox( height: height, width: width, child: Stack( fit: StackFit.expand, children: <Widget>[ _buildSingleDigit( context, digit: whole % 10, offset: height * decimal, opacity: 1 - decimal, ), _buildSingleDigit( context, digit: (whole + 1) % 10, offset: height * decimal - height, opacity: decimal, ), ], ), ); }, ); } Widget _buildSingleDigit(context, {int digit, double offset, double opacity}) { return Positioned( child: SizedBox( width: width, child: Opacity( opacity: opacity, child: Text( "$digit", style: Theme.of(context).textTheme.bodyText1, textAlign: TextAlign.center, ), ), ), bottom: offset, ); } }
0
mirrored_repositories/Flutter-Pomodoro-App/lib
mirrored_repositories/Flutter-Pomodoro-App/lib/models/pomodoro.dart
import 'package:flutter/material.dart'; import 'package:shared_preferences/shared_preferences.dart'; enum PMode { Study, Break, LongBreak } class Pomodoro { int count = 0; int step = 0; int breakTime = 5 * 60; int studyTime = 25 * 60; int longBreakTime = 30 * 60; bool running = false; Map colorMap = { PMode.Study: Colors.red, PMode.Break: Colors.indigo, PMode.LongBreak: Colors.indigoAccent }; PMode mode = PMode.Study; void init() async { SharedPreferences prefs = await SharedPreferences.getInstance(); count = (prefs.getInt('counter') ?? 0); step = (prefs.getInt('step') ?? 0); mode = PMode.values[(prefs.getInt('mode') ?? 0)]; } void increasePomodoro() async { SharedPreferences prefs = await SharedPreferences.getInstance(); if (running) count += 1; await prefs.setInt('counter', count); // checkss if ((count == breakTime && mode == PMode.Break) || (count == longBreakTime && mode == PMode.LongBreak)) { await skip(); } if ((count == studyTime && mode == PMode.Study)) { await skip(); } // check end } skip() async { SharedPreferences prefs = await SharedPreferences.getInstance(); count = 0; switch (mode) { case PMode.Break: mode = PMode.Study; await prefs.setInt('counter', count); prefs.setInt('mode', PMode.values.indexOf(mode)); prefs.setInt('step', step); break; case PMode.LongBreak: mode = PMode.Study; await prefs.setInt('counter', count); prefs.setInt('mode', PMode.values.indexOf(mode)); prefs.setInt('step', step); break; case PMode.Study: step += 1; if (step % 4 == 0) { mode = PMode.LongBreak; } else { mode = PMode.Break; } await prefs.setInt('counter', count); prefs.setInt('mode', PMode.values.indexOf(mode)); prefs.setInt('step', step); break; } } double get percentage { switch (mode) { case PMode.Break: return count / breakTime; case PMode.LongBreak: return count / longBreakTime; case PMode.Study: return count / studyTime; default: return 5; } } Color get getColor { return colorMap[mode]; } String get readTime { int time; switch (mode) { case PMode.Break: time = breakTime; break; case PMode.LongBreak: time = longBreakTime; break; case PMode.Study: time = studyTime; break; } int ct = time - count; int seconds = (ct % 60); int minutes = (ct / 60).floor(); return "${minutes > 9 ? minutes : '0$minutes'}:${seconds > 9 ? seconds : '0$seconds'}"; } String get modeText { switch (mode) { case PMode.Break: return "break"; case PMode.LongBreak: return "long break"; case PMode.Study: return "study"; default: return ""; } } int get stepCount { return step; } bool get isRunning { return running; } void toggleRunning() { running = !running; } void resetProgress() async { count = 0; step = 0; mode = PMode.Study; SharedPreferences prefs = await SharedPreferences.getInstance(); await prefs.setInt('counter', count); await prefs.setInt('mode', PMode.values.indexOf(mode)); await prefs.setInt('step', step); } }
0
mirrored_repositories/Flutter-Pomodoro-App/lib
mirrored_repositories/Flutter-Pomodoro-App/lib/screens/home.dart
import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:pomodoro/models/pomodoro.dart'; import 'package:pomodoro/widgets/digit.dart'; class HomePage extends StatefulWidget { HomePage({Key key}) : super(key: key); @override _HomePageState createState() => _HomePageState(); } class _HomePageState extends State<HomePage> with TickerProviderStateMixin { Animation animation; AnimationController controller; Pomodoro pomodoro = new Pomodoro(); @override void initState() { super.initState(); SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( systemNavigationBarColor: Color(0xFF212121), // navigation bar color statusBarColor: Color(0xFF101010), // status bar color )); pomodoro.init(); controller = AnimationController( duration: const Duration(milliseconds: 500), vsync: this); Timer timer = new Timer.periodic(Duration(milliseconds: 1000), (timer) { setState(() { pomodoro.increasePomodoro(); }); }); } _onpressed() { setState(() { pomodoro.toggleRunning(); pomodoro.isRunning ? controller.forward() : controller.reverse(); }); } @override Widget build(BuildContext context) { return Scaffold( appBar: null, body: SafeArea( child: Container( width: double.infinity, height: MediaQuery.of(context).size.height, child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ Container( child: Column( children: <Widget>[ Stack( children: <Widget>[ Padding( padding: const EdgeInsets.all(12.0), child: AnimatedFlipCounter( duration: Duration(milliseconds: 100), value: pomodoro.readTime, /* pass in a number like 2014 */ color: Colors.black, size: MediaQuery.of(context).size.width / 3, ) /* Text( pomodoro.readTime, style: (Theme.of(context).textTheme.bodyText1), ), */ ), Positioned( child: RotationTransition( turns: AlwaysStoppedAnimation(5 / 100), child: Text( pomodoro.stepCount.toString(), style: Theme.of(context) .textTheme .bodyText2 .copyWith(color: pomodoro.getColor), ), ), top: 0, right: 0, ) ], ), buildAnimatedContainer(context), SizedBox( height: 5, ), Text( pomodoro.modeText, style: Theme.of(context) .textTheme .bodyText2 .copyWith(color: pomodoro.getColor), ), ], ), ), Container( padding: EdgeInsets.all(10), child: Column( children: <Widget>[ Row( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ IconButton( icon: Icon(Icons.skip_next), onPressed: () => pomodoro.skip(), iconSize: 55, color: Colors.grey), IconButton( icon: Icon(Icons.undo), onPressed: () => pomodoro.resetProgress(), iconSize: 55, color: Colors.grey), /* IconButton( icon: Icon(Icons.settings), onPressed: () => null, iconSize: 55, color: Colors.indigo), */ //TODO Add settings page ], ), IconButton( icon: AnimatedIcon( icon: AnimatedIcons.play_pause, progress: controller, ), iconSize: 125, color: pomodoro.isRunning ? Colors.red : Colors.green, onPressed: _onpressed, ), ], ), ) ], ), ), ), ); } AnimatedContainer buildAnimatedContainer(BuildContext context) { return AnimatedContainer( margin: EdgeInsets.only(left: 0), width: (MediaQuery.of(context).size.width - 100) * pomodoro.percentage + 10, height: 10, decoration: BoxDecoration( color: pomodoro.getColor, borderRadius: BorderRadius.circular(15), ), duration: Duration(seconds: 1), curve: Curves.fastOutSlowIn, ); } }
0
mirrored_repositories/Flutter-Pomodoro-App
mirrored_repositories/Flutter-Pomodoro-App/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility 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:pomodoro/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/co_working_app
mirrored_repositories/co_working_app/lib/main.dart
import 'package:co_working_app/screens/home/home_screen.dart'; import 'package:co_working_app/theme/style.dart'; import 'package:flutter/material.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( title: 'Co-working app', theme: appTheme(), debugShowCheckedModeBanner: false, home: HomeScreen(), ); } } class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key); // This widget is the home page of your application. It is stateful, meaning // that it has a State object (defined below) that contains fields that affect // how it looks. // This class is the configuration for the state. It holds the values (in this // case the title) provided by the parent (in this case the App widget) and // used by the build method of the State. Fields in a Widget subclass are // always marked "final". final String title; @override _MyHomePageState createState() => _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> { int _counter = 0; void _incrementCounter() { setState(() { // This call to setState tells the Flutter framework that something has // changed in this State, which causes it to rerun the build method below // so that the display can reflect the updated values. If we changed // _counter without calling setState(), then the build method would not be // called again, and so nothing would appear to happen. _counter++; }); } @override Widget build(BuildContext context) { // This method is rerun every time setState is called, for instance as done // by the _incrementCounter method above. // // The Flutter framework has been optimized to make rerunning build methods // fast, so that you can just rebuild anything that needs updating rather // than having to individually change instances of widgets. return Scaffold( appBar: AppBar( // Here we take the value from the MyHomePage object that was created by // the App.build method, and use it to set our appbar title. title: Text(widget.title), ), body: Center( // Center is a layout widget. It takes a single child and positions it // in the middle of the parent. child: Column( // Column is also a layout widget. It takes a list of children and // arranges them vertically. By default, it sizes itself to fit its // children horizontally, and tries to be as tall as its parent. // // Invoke "debug painting" (press "p" in the console, choose the // "Toggle Debug Paint" action from the Flutter Inspector in Android // Studio, or the "Toggle Debug Paint" command in Visual Studio Code) // to see the wireframe for each widget. // // Column has various properties to control how it sizes itself and // how it positions its children. Here we use mainAxisAlignment to // center the children vertically; the main axis here is the vertical // axis because Columns are vertical (the cross axis would be // horizontal). mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Text( 'You have pushed the button this many times:', ), Text( '$_counter', style: Theme.of(context).textTheme.headline4, ), ], ), ), floatingActionButton: FloatingActionButton( onPressed: _incrementCounter, tooltip: 'Increment', child: Icon(Icons.add), ), // This trailing comma makes auto-formatting nicer for build methods. ); } }
0
mirrored_repositories/co_working_app/lib
mirrored_repositories/co_working_app/lib/widgets/icone_container.dart
import 'package:co_working_app/models/category.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; class IconContainer extends StatelessWidget { final Category category; const IconContainer({ Key key, @required this.category, }) : super(key: key); @override Widget build(BuildContext context) { return Center( child: Column( children: <Widget>[ Container( width: 65, height: 65, decoration: BoxDecoration( color: Color(category.color), borderRadius: BorderRadius.circular(20)), child: Align( alignment: Alignment.center, child: category.iconPath.isNotEmpty ? SvgPicture.asset( category.iconPath, placeholderBuilder: (context) => CircularProgressIndicator(), color: category.iconColor != 0 ? Color(category.iconColor) : Colors.white, height: 35, width: 35, ) : IconButton( icon: Icon(category.icon), color: category.iconColor != 0 ? Color(category.iconColor) : Colors.white, iconSize: 40, onPressed: () {}, ))), SizedBox( height: 10, ), Text( category.name, style: TextStyle(fontSize: 16, fontWeight: FontWeight.w400), ) ], ), ); } }
0
mirrored_repositories/co_working_app/lib
mirrored_repositories/co_working_app/lib/models/category.dart
import 'package:flutter/material.dart'; import 'package:material_design_icons_flutter/material_design_icons_flutter.dart'; class Category { String name; int color; IconData icon; int iconColor; String iconPath; Category({this.name, this.color, this.icon, this.iconColor, this.iconPath}); }
0
mirrored_repositories/co_working_app/lib
mirrored_repositories/co_working_app/lib/models/coworking.dart
import 'package:co_working_app/models/user.dart'; import 'category.dart'; class Coworking { String coworkingId; String name; String city; String address; String image; double rating; int numberOfMembers; int price; List<Category> coworkingEquipments; User user; List<User> participants; Coworking({this.coworkingId, this.name, this.city, this.address, this.image, this.rating, this.numberOfMembers, this.price, this.coworkingEquipments, this.user, this.participants}); }
0
mirrored_repositories/co_working_app/lib
mirrored_repositories/co_working_app/lib/models/user.dart
class User { String name; String position; String avatarUrl; User({this.name, this.position, this.avatarUrl}); }
0
mirrored_repositories/co_working_app/lib
mirrored_repositories/co_working_app/lib/data/data.dart
import 'package:co_working_app/models/category.dart'; import 'package:co_working_app/models/user.dart'; import 'package:co_working_app/models/coworking.dart'; import 'package:co_working_app/utils/assets_utils.dart'; import 'package:material_design_icons_flutter/material_design_icons_flutter.dart'; // Category final _categoryCafe = Category( name: "Cafe", color: 0xFF52CBF8, icon: MdiIcons.coffeeMaker, iconColor: 0, iconPath: getIconCoffeeMug()); final _categoryOffice = Category(name: "Office", color: 0xFF96BE57, icon: MdiIcons.officeBuilding, iconColor: 0, iconPath: ""); final _categorySpace = Category(name: "Space", color: 0xFFFF8987, icon: MdiIcons.spaceStation, iconColor: 0, iconPath: getIconHomeOutline()); final _categorySeeAll = Category(name: "See All", color: 0xFFA986FF, icon: MdiIcons.selectAll, iconColor: 0, iconPath: getIconVisualization2()); List<Category> categories2() { return <Category> [ _categoryCafe, _categoryOffice, _categorySpace, _categorySeeAll ]; } // Coworking equipments final _equipmentWifi = Category(name: "Wifi", color: 0xFFECEFF1, icon: MdiIcons.wifi, iconColor: 0xFF7049FA, iconPath: ""); final _equipmentAC = Category(name: "AC", color: 0xFFECEFF1, icon: MdiIcons.printer, iconColor: 0xFF7049FA, iconPath: ""); final _equipmentFood = Category(name: "Food", color: 0xFFECEFF1, icon: MdiIcons.food, iconColor: 0xFF7049FA, iconPath: getFoodServing()); final _equipmentSpace = Category(name: "Coffee", color: 0xFFECEFF1, icon: MdiIcons.coffeeToGo, iconColor: 0xFF7049FA, iconPath: getIconCoffeeMug()); List<Category> coworkingEquipments() { return <Category> [ _equipmentWifi, _equipmentAC, _equipmentFood, _equipmentSpace ]; } // User final User _currentUser = User(name: "Laura Menzel", position: "Owner", avatarUrl: getImgAvatarCurrentUser()); final User _userAlicja = User(name: "Alicja Dunkley", position: "Owner", avatarUrl: getImgAvatarAlicja()); final User _userGianni = User(name: "Gianni Mcneill", position: "Owner", avatarUrl: getImgAvatarGianni()); final User _userMikail = User(name: "Mikail Tanner", position: "Owner", avatarUrl: getImgAvatarMikail()); final User _userEvieMai = User(name: "Evie-Mai Busby", position: "Owner", avatarUrl: getImgAvatarEvieMai()); final User _userWilf = User(name: "Wilf Kendall", position: "Owner", avatarUrl: getImgAvatarWilf()); User currentUser() { return _currentUser; } List<User> users() { return <User> [ _currentUser, _userAlicja, _userGianni, _userMikail, _userEvieMai, _userWilf ]; } //Coworking final _cwkStrasbourg = Coworking( coworkingId : "cwk001", name : "Lain Coworking", city: "Strasbourg", address: "11 Rue jean jaurès, Strasbourg, France", image: getImgCwkStrasbourg(), rating: 4.5, numberOfMembers: 54, price: 30, coworkingEquipments: coworkingEquipments(), user: _currentUser, participants: [_userGianni, _userWilf] ); final _cwkMali = Coworking( coworkingId : "cwk002", name : "Mali Coworking", city: "Bamako", address: "8 Rue Kankou Moussa, Bamako, Mali", image: getImgCwkMali(), rating: 4.8, numberOfMembers: 80, price: 41, coworkingEquipments: coworkingEquipments(), user: _userAlicja, participants: [_currentUser, _userAlicja] ); final _cwkParis = Coworking( coworkingId : "cwk003", name : "Paris Coworking", city: "Paris", address: "16 Rue Robespierre, Paris, France", image: getImgCwkParis(), rating: 4.3, numberOfMembers: 26, price: 35, coworkingEquipments: coworkingEquipments(), user: _userGianni, participants: [_userMikail, _userEvieMai] ); final _cwkLyon = Coworking( coworkingId : "cwk004", name : "Lyon Coworking", city: "Lyon", address: "1 Rue Anatole, Lyon, France", image: getImgCwkLyon(), rating: 4.1, numberOfMembers: 39, price: 25, coworkingEquipments: coworkingEquipments(), user: _userWilf, participants: [_userGianni, _currentUser] ); final _cwkLille = Coworking( coworkingId : "cwk005", name : "Lille Coworking", city: "Lille", address: "105 Rue Charle Degaulle, Lille, France", image: getImgCwkLille(), rating: 3.9, numberOfMembers: 76, price: 52, coworkingEquipments: coworkingEquipments(), user: _userEvieMai, participants: [_userGianni, _userEvieMai] ); List<Coworking> coworkings() { return <Coworking> [ _cwkStrasbourg, _cwkMali, _cwkParis, _cwkLyon, _cwkLille ]; }
0
mirrored_repositories/co_working_app/lib
mirrored_repositories/co_working_app/lib/theme/style.dart
import 'package:flutter/material.dart'; ThemeData appTheme() { return ThemeData( primaryColor: Color(0xFF7049FA), /* accentColor: Colors.orange, hintColor: Colors.white, dividerColor: Colors.white, buttonColor: Colors.white, scaffoldBackgroundColor: Colors.black, canvasColor: Colors.black,*/ ); }
0
mirrored_repositories/co_working_app/lib
mirrored_repositories/co_working_app/lib/theme/icons.dart
import 'package:flutter/material.dart'; const iconSearch = 'assets/icon/search.svg';
0
mirrored_repositories/co_working_app/lib
mirrored_repositories/co_working_app/lib/utils/assets_utils.dart
// Icon assets String getIconCoffeeMug() { return "assets/icon/coffee-mug.svg"; } String getIconHomeOutline() { return "assets/icon/home_outline.svg"; } String getIconVisualization() { return "assets/icon/visualization.svg"; } String getIconVisualization2() { return "assets/icon/visualization_2.svg"; } String getIconMenuAlt05() { return "assets/icon/menu_alt_05.svg"; } String getFoodServing() { return "assets/icon/food_serving.svg"; } // Image URL and Assets path // Avatar String getImgAvatarCurrentUser() { return "https://images.unsplash.com/photo-1578489758854-f134a358f08b?ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=80"; } String getImgAvatarAlicja() { return "https://images.unsplash.com/photo-1494790108377-be9c29b29330?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=600&q=80"; } String getImgAvatarGianni() { return "https://images.unsplash.com/photo-1569913486515-b74bf7751574?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=600&q=80"; } String getImgAvatarMikail() { return "https://images.unsplash.com/photo-1543610892-0b1f7e6d8ac1?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=600&q=80"; } String getImgAvatarEvieMai() { return "https://images.unsplash.com/photo-1557296387-5358ad7997bb?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=600&q=80"; } String getImgAvatarWilf() { return "https://images.unsplash.com/photo-1544348817-5f2cf14b88c8?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=600&q=80"; } // Coworking image String getImgCwkStrasbourg() { return "https://images.unsplash.com/photo-1556761175-4b46a572b786?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=80"; } String getImgCwkMali() { return "https://images.unsplash.com/photo-1562664348-cb222fdcfa86?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=80"; } String getImgCwkParis() { return "https://images.unsplash.com/photo-1556761175-5973dc0f32e7?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=80"; } String getImgCwkLyon() { return "https://images.unsplash.com/photo-1562664348-2188b99b5157?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=80"; } String getImgCwkLille() { return "https://images.unsplash.com/photo-1519155031214-e8d583928bf2?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=80"; }
0
mirrored_repositories/co_working_app/lib/screens
mirrored_repositories/co_working_app/lib/screens/coworking_details/coworking_detail_screen.dart
import 'package:cached_network_image/cached_network_image.dart'; import 'package:co_working_app/data/data.dart'; import 'package:co_working_app/models/category.dart'; import 'package:co_working_app/models/coworking.dart'; import 'package:co_working_app/widgets/icone_container.dart'; import 'package:flutter/material.dart'; import 'package:material_design_icons_flutter/material_design_icons_flutter.dart'; class CoworkingDetailScreen extends StatefulWidget { final Coworking coworking; CoworkingDetailScreen({this.coworking}); @override _CoworkingDetailScreenState createState() => _CoworkingDetailScreenState(); } class _CoworkingDetailScreenState extends State<CoworkingDetailScreen> { @override Widget build(BuildContext context) { return Scaffold( body: Stack( children: <Widget>[ Hero( tag: widget.coworking.coworkingId, child: Image( height: 220.0, width: MediaQuery.of(context).size.width, image: CachedNetworkImageProvider(widget.coworking.image), fit: BoxFit.cover, ), ), Padding( padding: EdgeInsets.symmetric(vertical: 30.0, horizontal: 10.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ Container( decoration: BoxDecoration( color: Colors.white.withOpacity(0.7), borderRadius: BorderRadiusDirectional.circular(50.0)), child: IconButton( icon: Icon(Icons.arrow_back), color: Theme.of(context).primaryColor, iconSize: 30.0, onPressed: () => Navigator.pop(context), ), ), Container( decoration: BoxDecoration( color: Colors.white.withOpacity(0.7), borderRadius: BorderRadiusDirectional.circular(50.0)), child: IconButton( icon: Icon(MdiIcons.axisZRotateCounterclockwise), color: Theme.of(context).primaryColor, iconSize: 30.0, onPressed: () => {}, ), ), ], ), ), DraggableScrollableSheet( initialChildSize: 0.70, minChildSize: 0.70, maxChildSize: 0.75, builder: (BuildContext context, ScrollController scrollController) { return Container( decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only( topLeft: Radius.circular(30.0), topRight: Radius.circular(30.0)), boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.5), spreadRadius: 5, blurRadius: 7, offset: Offset(0, 3), // changes position of shadow ), ], ), child: ListView( physics: BouncingScrollPhysics(), children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Center( child: Container( height: 8, width: 50, decoration: BoxDecoration( color: Colors.grey[400], borderRadius: BorderRadius.circular(50.0)), ), ), Padding( padding: const EdgeInsets.only( top: 30, left: 25, right: 25, bottom: 15), child: Text( widget.coworking.name, style: TextStyle( fontSize: 25, fontWeight: FontWeight.bold), ), ), Padding( padding: const EdgeInsets.only( left: 25, right: 25, bottom: 30), child: Text( widget.coworking.address, style: TextStyle( fontSize: 17, color: Colors.black38), ), ), Padding( padding: const EdgeInsets.only( left: 25, right: 25, bottom: 30), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ IconContainer(category: widget.coworking.coworkingEquipments[0]), IconContainer(category: widget.coworking.coworkingEquipments[1]), IconContainer(category: widget.coworking.coworkingEquipments[2]), IconContainer(category: widget.coworking.coworkingEquipments[3]) ], ), ), Padding( padding: const EdgeInsets.only( left: 25, right: 25, bottom: 30), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only(bottom: 10), child: Text( widget.coworking.user.name, style: TextStyle( fontSize: 18, fontWeight: FontWeight.w500), ), ), Text( widget.coworking.user.position + ' ' + widget.coworking.name, style: TextStyle( color: Colors.black38, fontWeight: FontWeight.w400, fontSize: 15), ), ], ), Container( height: 60, width: 60, child: CachedNetworkImage( imageUrl: widget.coworking.user.avatarUrl, imageBuilder: (context, imageProvider) => Container( decoration: BoxDecoration( shape: BoxShape.circle, image: DecorationImage( image: imageProvider, fit: BoxFit.cover, colorFilter: ColorFilter.mode( Theme.of(context) .primaryColor .withOpacity(0.3), BlendMode.colorBurn)), ), ), placeholder: (context, url) => new CircularProgressIndicator(), errorWidget: (context, url, error) => new Icon(Icons.error), )) ], ), ) ], ), Align( alignment: Alignment.bottomCenter, child: Container( height: 130, width: double.infinity, decoration: BoxDecoration( color: Colors.blueGrey[50], borderRadius: BorderRadius.only( topRight: Radius.circular(35), topLeft: Radius.circular(35))), child: Padding( padding: const EdgeInsets.only(left: 25, right: 25, top: 35), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only(bottom: 10), child: Text( 'Price', style: TextStyle( fontSize: 16, color: Colors.black54, fontWeight: FontWeight.w500 ), ), ), Text( '\$' + widget.coworking.price.toString() +'/hour', style: TextStyle( fontSize: 25, color: Colors.black, fontWeight: FontWeight.bold ), ) ], ), Align( alignment: Alignment.topCenter, child: RaisedButton( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(50.0), side: BorderSide(color: Theme.of(context).primaryColor)), onPressed: () {}, color: Theme.of(context).primaryColor, padding: EdgeInsets.only(top: 20, bottom: 20, left: 40, right: 40), textColor: Colors.white, child: Text( "Contact Now!", style: TextStyle(fontSize: 16) ), ), ), ], ), ), ), ) ], )); }, ) ], ), ); } }
0
mirrored_repositories/co_working_app/lib/screens
mirrored_repositories/co_working_app/lib/screens/home/home_screen.dart
import 'package:cached_network_image/cached_network_image.dart'; import 'package:co_working_app/data/data.dart'; import 'package:co_working_app/models/coworking.dart'; import 'package:co_working_app/screens/coworking_details/coworking_detail_screen.dart'; import 'package:co_working_app/utils/assets_utils.dart'; import 'package:co_working_app/widgets/icone_container.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; class HomeScreen extends StatefulWidget { @override _HomeState createState() => _HomeState(); const HomeScreen({ Key key }) : super(key: key); } class _HomeState extends State<HomeScreen> { List<Coworking> coworkingsData = coworkings(); Widget _buildSearchTextField() { return Row( mainAxisAlignment: MainAxisAlignment.start, mainAxisSize: MainAxisSize.max, children: <Widget>[ Expanded( child: TextField( decoration: InputDecoration( contentPadding: EdgeInsets.symmetric(vertical: 20.0), fillColor: Colors.blueGrey[50], filled: true, border: OutlineInputBorder( borderRadius: BorderRadius.circular(30.0), borderSide: BorderSide(width: 0.8), ), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(30.0), borderSide: BorderSide( width: 0.8, color: Theme.of(context).primaryColor, ), ), hintText: 'Find coworking...', prefixIcon: Padding( padding: const EdgeInsets.all(15.0), child: Icon( Icons.search, size: 30.0 ), ), suffixIcon: Container( width: 70, color: Colors.transparent, child: IntrinsicHeight( child: Row( children: [ Padding( padding: const EdgeInsets.only(top: 8, bottom: 8, right: 10), child: VerticalDivider( width: 10.0, color: Theme.of(context).primaryColor, ) ), Padding( padding: const EdgeInsets.all(1.0), child: Icon( Icons.keyboard_arrow_down, size: 30.0 ), ), ], ), ), ), ), ), ) ], ); } Widget _buildListRecommendation(BuildContext context, Coworking coworking) { return GestureDetector( onTap: () => Navigator.push( context, MaterialPageRoute( builder: (context) => CoworkingDetailScreen(coworking: coworking) ) ), child: Center( child: Stack( alignment: Alignment.center, children: <Widget>[ Hero( tag: coworking.coworkingId, child: Container( margin: EdgeInsets.symmetric(horizontal: 20, vertical: 20), height: 310, width: 260, decoration: BoxDecoration( borderRadius: BorderRadius.circular(30), image: DecorationImage( image: CachedNetworkImageProvider(coworking.image), fit: BoxFit.cover ) ), ), ), Container( height: 310, width: 260, decoration: BoxDecoration( borderRadius: BorderRadius.circular(30.0), gradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ Colors.black87.withOpacity(0.2), Colors.black54.withOpacity(0.7), Colors.black38.withOpacity(0.7), Colors.black38.withOpacity(0.3), ], stops: [0.1, 0.7, 0.8, 0.9] ) ), ), Positioned( top: 165.0, width: 210, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Padding( padding: const EdgeInsets.symmetric(horizontal: 0), child: Text( coworking.name, style: TextStyle( color: Colors.white, fontSize: 24.0, fontWeight: FontWeight.bold, letterSpacing: 1.2 ), ), ), SizedBox(height: 10,), Text( coworking.city, style: TextStyle( color: Colors.white, fontSize: 18.0, fontWeight: FontWeight.w400, letterSpacing: 1.2 ), ), ], ), ), Positioned( bottom: 20.0, right: 20.0, child: Container( height: 80, width: 260, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only(bottomLeft: Radius.circular(30), bottomRight: Radius.circular(30)) ), child: Row( children: <Widget>[ SizedBox(width: 25,), Icon( Icons.star, color: Theme.of(context).primaryColor ), SizedBox(width: 10,), Text( coworking.rating.toString(), style: TextStyle( fontSize: 16, fontWeight: FontWeight.w400 ), ), SizedBox(width: 50,), Stack( overflow: Overflow.visible, children: <Widget>[ Positioned( child: Container( width: 45, height: 45, decoration: BoxDecoration( border: Border.all(color: Colors.white, width: 2), borderRadius: BorderRadius.circular(50), image: DecorationImage( image: CachedNetworkImageProvider(coworking.participants[0].avatarUrl), fit: BoxFit.cover ) ), ), ), Positioned( width: 45, height: 45, left: 30, child: Container( decoration: BoxDecoration( border: Border.all(color: Colors.white, width: 2), borderRadius: BorderRadius.circular(50), image: DecorationImage( image: CachedNetworkImageProvider(coworking.participants[1].avatarUrl), fit: BoxFit.cover ) ), ), ), Positioned( width: 45, height: 45, left: 60, child: Container( decoration: BoxDecoration( border: Border.all(color: Colors.white, width: 2), borderRadius: BorderRadius.circular(50), color: Theme.of(context).primaryColor ), child: Padding( padding: EdgeInsets.all(12.0), child: Text( coworking.numberOfMembers.toString(), textAlign: TextAlign.center, style: TextStyle( color: Colors.white, fontWeight: FontWeight.w500 ), ), ), ), ) ], ), ], ), ), ) ] ), ), ); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.blueGrey[50], appBar: PreferredSize( preferredSize: Size.fromHeight(70), child: AppBar( backgroundColor: Colors.white, elevation: 0, centerTitle: true, leading: GestureDetector( onTap: () { Navigator.pop(context); }, child: Padding( padding: EdgeInsets.only(left: 10, top: 10), child: SvgPicture.asset( getIconMenuAlt05(), placeholderBuilder: (context) => CircularProgressIndicator(), color: Colors.black87, ), ), ), actions: <Widget>[ Padding( padding: const EdgeInsets.only(right: 15, top: 10), child: Container( height: 50, width: 50, child: CachedNetworkImage( imageUrl: currentUser().avatarUrl, imageBuilder: (context, imageProvider) => Container( decoration: BoxDecoration( shape: BoxShape.circle, image: DecorationImage( image: imageProvider, fit: BoxFit.cover, colorFilter: ColorFilter.mode(Theme.of(context).primaryColor.withOpacity(0.3), BlendMode.colorBurn)), ), ), placeholder: (context, url) => new CircularProgressIndicator(), errorWidget: (context, url, error) => new Icon(Icons.error), ) ) ) ], ), ), body: SingleChildScrollView( physics: BouncingScrollPhysics(), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Container( width: double.infinity, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only( bottomLeft: Radius.circular(30), bottomRight: Radius.circular(30) ) ), child: Padding( padding: EdgeInsets.symmetric(horizontal: 20), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Padding( padding: EdgeInsets.symmetric(vertical: 20), child: Text( 'Hi ' + currentUser().name + ',', style: TextStyle( color: Colors.black38, fontSize: 18 ), ), ), Padding( padding: EdgeInsets.only(bottom: 22), child: Text( 'Where today you\'''ll work ?', style: TextStyle( fontWeight: FontWeight.bold, fontSize: 25, letterSpacing: 1.2 ), ), ), _buildSearchTextField(), SizedBox( height: 35, ), Padding( padding: const EdgeInsets.only(bottom: 20), child: Text( 'Categories', style: TextStyle( fontSize: 20, fontWeight: FontWeight.w500 ), ), ), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Wrap( spacing: 25, runSpacing: 6, alignment: WrapAlignment.start, children: [ IconContainer(category: categories2()[0]), IconContainer(category: categories2()[1]), IconContainer(category: categories2()[2]), IconContainer(category: categories2()[3]), ], ), ], ), SizedBox(height: 40,), ], ), ) ), Padding( padding: EdgeInsets.only(left: 20, top: 30), child: Text( 'Recommended for you', style: TextStyle( fontSize: 20, fontWeight: FontWeight.w500 ), ), ), SizedBox( height: 350, child: ListView.builder( physics: BouncingScrollPhysics(), padding: EdgeInsets.only(left: 10.0), scrollDirection: Axis.horizontal, itemCount: coworkingsData.length, itemBuilder: (BuildContext context, int index) { Coworking coworking = coworkingsData[index]; return _buildListRecommendation(context, coworking); }, ), ) ], ), ) ); } }
0
mirrored_repositories/co_working_app
mirrored_repositories/co_working_app/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility 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:co_working_app/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/Todo_Flutter/todo
mirrored_repositories/Todo_Flutter/todo/lib/main.dart
import 'package:flutter/material.dart'; import 'package:scoped_model/scoped_model.dart'; import 'package:todo/redux/app_route.dart'; import 'package:todo/model/task_list_model.dart'; import 'package:todo/model/task_model.dart'; import 'package:todo/model/hero_id_model.dart'; import 'package:todo/model/data/choice_card.dart'; import 'package:todo/utils/datetime_utils.dart'; import 'package:todo/utils/color_utils.dart'; import 'package:todo/widgets/add_page_card/widget.dart'; import 'package:todo/widgets/gradient_background/widget.dart'; import 'package:todo/pages/page_path.dart'; import 'package:todo/widgets/task_card/widget.dart'; void main() { runApp(new MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { var app = MaterialApp( title: 'Todo', debugShowCheckedModeBanner: false, theme: ThemeData( primarySwatch: Colors.blueGrey, textTheme: TextTheme( headline: TextStyle(fontSize: 32.0, fontWeight: FontWeight.w400), title: TextStyle(fontSize: 28.0, fontWeight: FontWeight.w500), body1: TextStyle(fontSize: 14.0, fontFamily: 'Hint'), )), home: MyHomePage(title: ''), onGenerateRoute: (RouteSettings item) { return MaterialPageRoute<Object>(builder: (BuildContext context) { return AppRoute.global.buildPage(item.name, item.arguments); }); }, ); return ScopedModel<TodoListModel>( model: TodoListModel(), child: app, ); } } class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key); final String title; HeroId _generateHeroId(Task task) { return HeroId( nameId: 'name_id_${task.id}', codePointId: 'code_point_id_${task.id}', progressId: 'progress_id_${task.id}', remainingTaskId: 'remaining_task_id_${task.id}'); } @override _MyHomePageState createState() => new _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> with SingleTickerProviderStateMixin { AnimationController _controller; Animation<double> _animation; final GlobalKey _backdropKey = GlobalKey(debugLabel: 'Backdrop'); PageController _pageController; int _currentPageIndex = 0; @override void initState() { super.initState(); _controller = AnimationController( vsync: this, duration: Duration(milliseconds: 300), ); _animation = Tween<double>(begin: 0.0, end: 1.0).animate(_controller); _pageController = PageController(initialPage: 0, viewportFraction: 0.8); } @override Widget build(BuildContext context) { return ScopedModelDescendant<TodoListModel>( builder: (BuildContext context, Widget child, TodoListModel model) { bool _isLoading = model.isLoading; if (!_isLoading) { _controller.forward(); } var _tasks = model.tasks; var _todos = model.todos; var backgroundColor = _tasks.isEmpty || _tasks.length == _currentPageIndex ? Colors.blueGrey : ColorUtils.getColorFrom(_tasks[_currentPageIndex].color); return GradientBackground( color: backgroundColor, child: Scaffold( backgroundColor: Colors.transparent, appBar: AppBar( title: Text(widget.title), elevation: 0.0, backgroundColor: Colors.transparent, actions: <Widget>[ PopupMenuButton<Choice>( onSelected: (choice) { Navigator.of(context).pushNamed(PagePath.privacyPolicyPage); }, itemBuilder: (BuildContext context) { return choices.map((Choice choice) { return PopupMenuItem<Choice>( value: choice, child: Text(choice.title), ); }).toList(); }, ), ], ), body: _isLoading ? Center( child: CircularProgressIndicator( strokeWidth: 1.0, valueColor: new AlwaysStoppedAnimation<Color>(Colors.white), ), ) : FadeTransition( opacity: _animation, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Container( margin: EdgeInsets.only(top: 0.0, left: 56.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Container( child: Text( '${DateTimeUtils.currentDay}', style: Theme.of(context) .textTheme .headline .copyWith(color: Colors.white), )), Text( '${DateTimeUtils.currentDate} ${DateTimeUtils.currentMonth}', style: Theme.of(context).textTheme.title.copyWith( color: Colors.white.withOpacity(0.7)), ), Container(height: 16.0), Text( 'You have ${_todos.where((todo) => todo.isCompleted == 0).length} tasks to complete', style: Theme.of(context).textTheme.body1.copyWith( color: Colors.white.withOpacity(0.7)), ), Container(height: 16.0), ], ), ), Expanded( key: _backdropKey, flex: 1, child: NotificationListener<ScrollNotification>( onNotification: (notification) { if (notification is ScrollEndNotification) { var currentPage = _pageController.page.round().toInt(); if (_currentPageIndex != currentPage) { setState(() => _currentPageIndex = currentPage); } } return true; }, child: PageView.builder( controller: _pageController, itemBuilder: (BuildContext context, int index) { if (index == _tasks.length) { return AddPageCard(color: Colors.blueGrey); } else { return TaskCard( backdropKey: _backdropKey, task: _tasks[index], color: ColorUtils.getColorFrom( _tasks[index].color), heroId: widget._generateHeroId(_tasks[index]), totalTodos: model.getTotalTodosFrom(_tasks[index]), taskProgress: model.getTaskCompletionPercent( _tasks[index])); } }, itemCount: _tasks.length + 1, ), ), ), Container(height: 32.0) ], ), ), ), ); }); } @override void dispose() { _controller.dispose(); super.dispose(); } }
0
mirrored_repositories/Todo_Flutter/todo/lib
mirrored_repositories/Todo_Flutter/todo/lib/redux/app_route.dart
import 'package:fish_redux/fish_redux.dart'; import 'package:todo/pages/privacy_policy_page/page.dart'; import 'package:todo/pages/add_card_page/page.dart'; import 'package:todo/pages/add_task_page/page.dart'; import 'package:todo/pages/page_path.dart'; class AppRoute { static AbstractRoutes _global; static AbstractRoutes get global { if (_global == null) { _global = PageRoutes( pages: <String, Page<Object, dynamic>> { PagePath.privacyPolicyPage: PrivacyPolicyPage(), PagePath.addCardPage: AddCardPage(), PagePath.addTaskPage: AddTaskPage() }, ); } return _global; } }
0
mirrored_repositories/Todo_Flutter/todo/lib/widgets
mirrored_repositories/Todo_Flutter/todo/lib/widgets/delete_alert_dialog/widget.dart
import 'package:flutter/material.dart'; typedef void Callback(); class DeleteAlertDialog extends StatelessWidget { final Color color; final Callback onActionPressed; DeleteAlertDialog({@required this.color, @required this.onActionPressed}); Widget build(BuildContext context) { return FlatButton( textColor: color, child: Icon(Icons.delete), onPressed: () { showDialog( context: context, barrierDismissible: false, builder: (BuildContext context) { return AlertDialog( title: Text('Delete this card?'), content: SingleChildScrollView( child: Text( 'This is a one way street! Deleting this will remove all the task assigned in this card.'), ), actions: <Widget>[ FlatButton( child: Text('Delete'), onPressed: () { Navigator.of(context).pop(); Navigator.of(context).pop(); onActionPressed(); }, ), FlatButton( child: Text('Cacel'), textColor: Colors.grey, onPressed: () { Navigator.of(context).pop(); }, ) ], ); } ); }, ); } }
0
mirrored_repositories/Todo_Flutter/todo/lib/widgets
mirrored_repositories/Todo_Flutter/todo/lib/widgets/icon_picker/widget.dart
import 'package:flutter/material.dart'; import 'package:todo/widgets/todo_badge/widget.dart'; class IconPicker extends StatefulWidget { final ValueChanged<IconData> onIconChanged; final IconData currentIconData; final Color highlightColor, unHighlightColor; final List<IconData> icons = [ Icons.threesixty, Icons.threed_rotation, Icons.four_k, Icons.ac_unit, Icons.access_alarm, Icons.access_alarms, Icons.access_time, Icons.accessibility, Icons.accessibility_new, Icons.accessible, Icons.accessible_forward, Icons.account_balance, Icons.account_balance_wallet, Icons.account_box, Icons.account_circle, Icons.adb, Icons.add, Icons.add_a_photo, Icons.add_alarm, Icons.add_alert, Icons.add_box, Icons.add_call, Icons.add_circle, Icons.add_circle_outline, Icons.add_comment, Icons.add_location, Icons.add_photo_alternate, Icons.add_shopping_cart, Icons.add_to_home_screen, Icons.add_to_photos, Icons.add_to_queue, Icons.adjust, Icons.airline_seat_flat, Icons.airline_seat_flat_angled, Icons.airline_seat_individual_suite, Icons.airline_seat_legroom_extra, Icons.airline_seat_legroom_normal, Icons.airline_seat_legroom_reduced, Icons.airline_seat_recline_extra, Icons.airline_seat_recline_normal, Icons.airplanemode_active, Icons.airplanemode_inactive, Icons.airplay, Icons.airport_shuttle, Icons.alarm, Icons.alarm_add, Icons.alarm_off, Icons.alarm_on, Icons.album, Icons.all_inclusive, Icons.all_out, Icons.alternate_email, Icons.android, Icons.announcement, Icons.apps, Icons.archive, Icons.arrow_back, Icons.arrow_back_ios, Icons.arrow_downward, Icons.arrow_drop_down, Icons.arrow_drop_down_circle, Icons.arrow_drop_up, Icons.arrow_forward, Icons.arrow_forward_ios, Icons.arrow_left, Icons.arrow_right, Icons.arrow_upward, Icons.art_track, Icons.aspect_ratio, Icons.assessment, Icons.assignment, Icons.assignment_ind, Icons.assignment_late, Icons.assignment_return, Icons.assignment_returned, Icons.assignment_turned_in, Icons.assistant, Icons.assistant_photo, Icons.atm, Icons.attach_file, Icons.attach_money, Icons.attachment, Icons.audiotrack, Icons.autorenew, Icons.av_timer, Icons.backspace, Icons.backup, Icons.battery_alert, Icons.battery_charging_full, Icons.battery_full, Icons.battery_std, Icons.battery_unknown, Icons.beach_access, Icons.beenhere, Icons.block, Icons.bluetooth, Icons.bluetooth_audio, Icons.bluetooth_connected, Icons.bluetooth_disabled, Icons.bluetooth_searching, Icons.blur_circular, Icons.blur_linear, Icons.blur_off, Icons.blur_on, Icons.book, Icons.bookmark, Icons.bookmark_border, Icons.border_all, Icons.border_bottom, Icons.border_clear, Icons.border_color, Icons.border_horizontal, Icons.border_inner, Icons.border_left, Icons.border_outer, Icons.border_right, Icons.border_style, Icons.border_top, Icons.border_vertical, Icons.branding_watermark, Icons.brightness_1, Icons.brightness_2, Icons.brightness_3, Icons.brightness_4, Icons.brightness_5, Icons.brightness_6, Icons.brightness_7, Icons.brightness_auto, Icons.brightness_high, Icons.brightness_low, Icons.brightness_medium, Icons.broken_image, Icons.brush, Icons.bubble_chart, Icons.bug_report, Icons.build, Icons.burst_mode, Icons.business, Icons.business_center, Icons.cached, Icons.cake, Icons.calendar_today, Icons.calendar_view_day, Icons.call, Icons.call_end, Icons.call_made, Icons.call_merge, Icons.call_missed, Icons.call_missed_outgoing, Icons.call_received, Icons.call_split, Icons.call_to_action, Icons.camera, Icons.camera_alt, Icons.camera_enhance, Icons.camera_front, Icons.camera_rear, Icons.camera_roll, Icons.cancel, Icons.card_giftcard, Icons.card_membership, Icons.card_travel, Icons.casino, Icons.cast, Icons.cast_connected, Icons.category, Icons.center_focus_strong, Icons.center_focus_weak, Icons.change_history, Icons.chat, Icons.chat_bubble, Icons.chat_bubble_outline, Icons.check, Icons.check_box, Icons.check_box_outline_blank, Icons.check_circle, Icons.check_circle_outline, Icons.chevron_left, Icons.chevron_right, Icons.child_care, Icons.child_friendly, Icons.chrome_reader_mode, Icons.class_, Icons.clear, Icons.clear_all, Icons.close, Icons.closed_caption, Icons.cloud, Icons.cloud_circle, Icons.cloud_done, Icons.cloud_download, Icons.cloud_off, Icons.cloud_queue, Icons.cloud_upload, Icons.code, Icons.collections, Icons.collections_bookmark, Icons.color_lens, Icons.colorize, Icons.comment, Icons.compare, Icons.compare_arrows, Icons.computer, Icons.confirmation_number, Icons.contact_mail, Icons.contact_phone, Icons.contacts, Icons.content_copy, Icons.content_cut, Icons.content_paste, Icons.control_point, Icons.control_point_duplicate, Icons.copyright, Icons.create, Icons.create_new_folder, Icons.credit_card, Icons.crop, Icons.crop_16_9, Icons.crop_3_2, Icons.crop_5_4, Icons.crop_7_5, Icons.crop_din, Icons.crop_free, Icons.crop_landscape, Icons.crop_original, Icons.crop_portrait, Icons.crop_rotate, Icons.crop_square, Icons.dashboard, Icons.data_usage, Icons.date_range, Icons.dehaze, Icons.delete, Icons.delete_forever, Icons.delete_outline, Icons.delete_sweep, Icons.departure_board, Icons.description, Icons.desktop_mac, Icons.desktop_windows, Icons.details, Icons.developer_board, Icons.developer_mode, Icons.device_hub, Icons.device_unknown, Icons.devices, Icons.devices_other, Icons.dialer_sip, Icons.dialpad, Icons.directions, Icons.directions_bike, Icons.directions_boat, Icons.directions_bus, Icons.directions_car, Icons.directions_railway, Icons.directions_run, Icons.directions_subway, Icons.directions_transit, Icons.directions_walk, Icons.disc_full, Icons.dns, Icons.do_not_disturb, Icons.do_not_disturb_alt, Icons.do_not_disturb_off, Icons.do_not_disturb_on, Icons.dock, Icons.domain, Icons.done, Icons.done_all, Icons.done_outline, Icons.donut_large, Icons.donut_small, Icons.drafts, Icons.drag_handle, Icons.drive_eta, Icons.dvr, Icons.edit, Icons.edit_attributes, Icons.edit_location, Icons.eject, Icons.email, Icons.enhanced_encryption, Icons.equalizer, Icons.error, Icons.error_outline, Icons.euro_symbol, Icons.ev_station, Icons.event, Icons.event_available, Icons.event_busy, Icons.event_note, Icons.event_seat, Icons.exit_to_app, Icons.expand_less, Icons.expand_more, Icons.explicit, Icons.explore, Icons.exposure, Icons.exposure_neg_1, Icons.exposure_neg_2, Icons.exposure_plus_1, Icons.exposure_plus_2, Icons.exposure_zero, Icons.extension, Icons.face, Icons.fast_forward, Icons.fast_rewind, Icons.fastfood, Icons.favorite, Icons.favorite_border, Icons.featured_play_list, Icons.featured_video, Icons.feedback, Icons.fiber_dvr, Icons.fiber_manual_record, Icons.fiber_new, Icons.fiber_pin, Icons.fiber_smart_record, Icons.file_download, Icons.file_upload, Icons.filter, Icons.filter_1, Icons.filter_2, Icons.filter_3, Icons.filter_4, Icons.filter_5, Icons.filter_6, Icons.filter_7, Icons.filter_8, Icons.filter_9, Icons.filter_9_plus, Icons.filter_b_and_w, Icons.filter_center_focus, Icons.filter_drama, Icons.filter_frames, Icons.filter_hdr, Icons.filter_list, Icons.filter_none, Icons.filter_tilt_shift, Icons.filter_vintage, Icons.find_in_page, Icons.find_replace, Icons.fingerprint, Icons.first_page, Icons.fitness_center, Icons.flag, Icons.flare, Icons.flash_auto, Icons.flash_off, Icons.flash_on, Icons.flight, Icons.flight_land, Icons.flight_takeoff, Icons.flip, Icons.flip_to_back, Icons.flip_to_front, Icons.folder, Icons.folder_open, Icons.folder_shared, Icons.folder_special, Icons.font_download, Icons.format_align_center, Icons.format_align_justify, Icons.format_align_left, Icons.format_align_right, Icons.format_bold, Icons.format_clear, Icons.format_color_fill, Icons.format_color_reset, Icons.format_color_text, Icons.format_indent_decrease, Icons.format_indent_increase, Icons.format_italic, Icons.format_line_spacing, Icons.format_list_bulleted, Icons.format_list_numbered, Icons.format_list_numbered_rtl, Icons.format_paint, Icons.format_quote, Icons.format_shapes, Icons.format_size, Icons.format_strikethrough, Icons.format_textdirection_l_to_r, Icons.format_textdirection_r_to_l, Icons.format_underlined, Icons.forum, Icons.forward, Icons.forward_10, Icons.forward_30, Icons.forward_5, Icons.free_breakfast, Icons.fullscreen, Icons.fullscreen_exit, Icons.functions, Icons.g_translate, Icons.gamepad, Icons.games, Icons.gavel, Icons.gesture, Icons.get_app, Icons.gif, Icons.golf_course, Icons.gps_fixed, Icons.gps_not_fixed, Icons.gps_off, Icons.grade, Icons.gradient, Icons.grain, Icons.graphic_eq, Icons.grid_off, Icons.grid_on, Icons.group, Icons.group_add, Icons.group_work, Icons.hd, Icons.hdr_off, Icons.hdr_on, Icons.hdr_strong, Icons.hdr_weak, Icons.headset, Icons.headset_mic, Icons.headset_off, Icons.healing, Icons.hearing, Icons.help, Icons.help_outline, Icons.high_quality, Icons.highlight, Icons.highlight_off, Icons.history, Icons.home, Icons.hot_tub, Icons.hotel, Icons.hourglass_empty, Icons.hourglass_full, Icons.http, Icons.https, Icons.image, Icons.image_aspect_ratio, Icons.import_contacts, Icons.import_export, Icons.important_devices, Icons.inbox, Icons.indeterminate_check_box, Icons.info, Icons.info_outline, Icons.input, Icons.insert_chart, Icons.insert_comment, Icons.insert_drive_file, Icons.insert_emoticon, Icons.insert_invitation, Icons.insert_link, Icons.insert_photo, Icons.invert_colors, Icons.invert_colors_off, Icons.iso, Icons.keyboard, Icons.keyboard_arrow_down, Icons.keyboard_arrow_left, Icons.keyboard_arrow_right, Icons.keyboard_arrow_up, Icons.keyboard_backspace, Icons.keyboard_capslock, Icons.keyboard_hide, Icons.keyboard_return, Icons.keyboard_tab, Icons.keyboard_voice, Icons.kitchen, Icons.label, Icons.label_important, Icons.label_outline, Icons.landscape, Icons.language, Icons.laptop, Icons.laptop_chromebook, Icons.laptop_mac, Icons.laptop_windows, Icons.last_page, Icons.launch, Icons.layers, Icons.layers_clear, Icons.leak_add, Icons.leak_remove, Icons.lens, Icons.library_add, Icons.library_books, Icons.library_music, Icons.lightbulb_outline, Icons.line_style, Icons.line_weight, Icons.linear_scale, Icons.link, Icons.link_off, Icons.linked_camera, Icons.list, Icons.live_help, Icons.live_tv, Icons.local_activity, Icons.local_airport, Icons.local_atm, Icons.local_bar, Icons.local_cafe, Icons.local_car_wash, Icons.local_convenience_store, Icons.local_dining, Icons.local_drink, Icons.local_florist, Icons.local_gas_station, Icons.local_grocery_store, Icons.local_hospital, Icons.local_hotel, Icons.local_laundry_service, Icons.local_library, Icons.local_mall, Icons.local_movies, Icons.local_offer, Icons.local_parking, Icons.local_pharmacy, Icons.local_phone, Icons.local_pizza, Icons.local_play, Icons.local_post_office, Icons.local_printshop, Icons.local_see, Icons.local_shipping, Icons.local_taxi, Icons.location_city, Icons.location_disabled, Icons.location_off, Icons.location_on, Icons.location_searching, Icons.lock, Icons.lock_open, Icons.lock_outline, Icons.looks, Icons.looks_3, Icons.looks_4, Icons.looks_5, Icons.looks_6, Icons.looks_one, Icons.looks_two, Icons.loop, Icons.loupe, Icons.low_priority, Icons.loyalty, Icons.mail, Icons.mail_outline, Icons.map, Icons.markunread, Icons.markunread_mailbox, Icons.maximize, Icons.memory, Icons.menu, Icons.merge_type, Icons.message, Icons.mic, Icons.mic_none, Icons.mic_off, Icons.minimize, Icons.missed_video_call, Icons.mms, Icons.mobile_screen_share, Icons.mode_comment, Icons.mode_edit, Icons.monetization_on, Icons.money_off, Icons.monochrome_photos, Icons.mood, Icons.mood_bad, Icons.more, Icons.more_horiz, Icons.more_vert, Icons.motorcycle, Icons.mouse, Icons.move_to_inbox, Icons.movie, Icons.movie_creation, Icons.movie_filter, Icons.multiline_chart, Icons.music_note, Icons.music_video, Icons.my_location, Icons.nature, Icons.nature_people, Icons.navigate_before, Icons.navigate_next, Icons.navigation, Icons.near_me, Icons.network_cell, Icons.network_check, Icons.network_locked, Icons.network_wifi, Icons.new_releases, Icons.next_week, Icons.nfc, Icons.no_encryption, Icons.no_sim, Icons.not_interested, Icons.not_listed_location, Icons.note, Icons.note_add, Icons.notification_important, Icons.notifications, Icons.notifications_active, Icons.notifications_none, Icons.notifications_off, Icons.notifications_paused, Icons.offline_bolt, Icons.offline_pin, Icons.ondemand_video, Icons.opacity, Icons.open_in_browser, Icons.open_in_new, Icons.open_with, Icons.outlined_flag, Icons.pages, Icons.pageview, Icons.palette, Icons.pan_tool, Icons.panorama, Icons.panorama_fish_eye, Icons.panorama_horizontal, Icons.panorama_vertical, Icons.panorama_wide_angle, Icons.party_mode, Icons.pause, Icons.pause_circle_filled, Icons.pause_circle_outline, Icons.payment, Icons.people, Icons.people_outline, Icons.perm_camera_mic, Icons.perm_contact_calendar, Icons.perm_data_setting, Icons.perm_device_information, Icons.perm_identity, Icons.perm_media, Icons.perm_phone_msg, Icons.perm_scan_wifi, Icons.person, Icons.person_add, Icons.person_outline, Icons.person_pin, Icons.person_pin_circle, Icons.personal_video, Icons.pets, Icons.phone, Icons.phone_android, Icons.phone_bluetooth_speaker, Icons.phone_forwarded, Icons.phone_in_talk, Icons.phone_iphone, Icons.phone_locked, Icons.phone_missed, Icons.phone_paused, Icons.phonelink, Icons.phonelink_erase, Icons.phonelink_lock, Icons.phonelink_off, Icons.phonelink_ring, Icons.phonelink_setup, Icons.photo, Icons.photo_album, Icons.photo_camera, Icons.photo_filter, Icons.photo_library, Icons.photo_size_select_actual, Icons.photo_size_select_large, Icons.photo_size_select_small, Icons.picture_as_pdf, Icons.picture_in_picture, Icons.picture_in_picture_alt, Icons.pie_chart, Icons.pie_chart_outlined, Icons.pin_drop, Icons.place, Icons.play_arrow, Icons.play_circle_filled, Icons.play_circle_outline, Icons.play_for_work, Icons.playlist_add, Icons.playlist_add_check, Icons.playlist_play, Icons.plus_one, Icons.poll, Icons.polymer, Icons.pool, Icons.portable_wifi_off, Icons.portrait, Icons.power, Icons.power_input, Icons.power_settings_new, Icons.pregnant_woman, Icons.present_to_all, Icons.print, Icons.priority_high, Icons.public, Icons.publish, Icons.query_builder, Icons.question_answer, Icons.queue, Icons.queue_music, Icons.queue_play_next, Icons.radio, Icons.radio_button_checked, Icons.radio_button_unchecked, Icons.rate_review, Icons.receipt, Icons.recent_actors, Icons.record_voice_over, Icons.redeem, Icons.redo, Icons.refresh, Icons.remove, Icons.remove_circle, Icons.remove_circle_outline, Icons.remove_from_queue, Icons.remove_red_eye, Icons.remove_shopping_cart, Icons.reorder, Icons.repeat, Icons.repeat_one, Icons.replay, Icons.replay_10, Icons.replay_30, Icons.replay_5, Icons.reply, Icons.reply_all, Icons.report, Icons.report_off, Icons.report_problem, Icons.restaurant, Icons.restaurant_menu, Icons.restore, Icons.restore_from_trash, Icons.restore_page, Icons.ring_volume, Icons.room, Icons.room_service, Icons.rotate_90_degrees_ccw, Icons.rotate_left, Icons.rotate_right, Icons.rounded_corner, Icons.router, Icons.rowing, Icons.rss_feed, Icons.rv_hookup, Icons.satellite, Icons.save, Icons.save_alt, Icons.scanner, Icons.scatter_plot, Icons.schedule, Icons.school, Icons.score, Icons.screen_lock_landscape, Icons.screen_lock_portrait, Icons.screen_lock_rotation, Icons.screen_rotation, Icons.screen_share, Icons.sd_card, Icons.sd_storage, Icons.search, Icons.security, Icons.select_all, Icons.send, Icons.sentiment_dissatisfied, Icons.sentiment_neutral, Icons.sentiment_satisfied, Icons.sentiment_very_dissatisfied, Icons.sentiment_very_satisfied, Icons.settings, Icons.settings_applications, Icons.settings_backup_restore, Icons.settings_bluetooth, Icons.settings_brightness, Icons.settings_cell, Icons.settings_ethernet, Icons.settings_input_antenna, Icons.settings_input_component, Icons.settings_input_composite, Icons.settings_input_hdmi, Icons.settings_input_svideo, Icons.settings_overscan, Icons.settings_phone, Icons.settings_power, Icons.settings_remote, Icons.settings_system_daydream, Icons.settings_voice, Icons.share, Icons.shop, Icons.shop_two, Icons.shopping_basket, Icons.shopping_cart, Icons.short_text, Icons.show_chart, Icons.shuffle, Icons.shutter_speed, Icons.signal_cellular_4_bar, Icons.signal_cellular_connected_no_internet_4_bar, Icons.signal_cellular_no_sim, Icons.signal_cellular_null, Icons.signal_cellular_off, Icons.signal_wifi_4_bar, Icons.signal_wifi_4_bar_lock, Icons.signal_wifi_off, Icons.sim_card, Icons.sim_card_alert, Icons.skip_next, Icons.skip_previous, Icons.slideshow, Icons.slow_motion_video, Icons.smartphone, Icons.smoke_free, Icons.smoking_rooms, Icons.sms, Icons.sms_failed, Icons.snooze, Icons.sort, Icons.sort_by_alpha, Icons.spa, Icons.space_bar, Icons.speaker, Icons.speaker_group, Icons.speaker_notes, Icons.speaker_notes_off, Icons.speaker_phone, Icons.spellcheck, Icons.star, Icons.star_border, Icons.star_half, Icons.stars, Icons.stay_current_landscape, Icons.stay_current_portrait, Icons.stay_primary_landscape, Icons.stay_primary_portrait, Icons.stop, Icons.stop_screen_share, Icons.storage, Icons.store, Icons.store_mall_directory, Icons.straighten, Icons.streetview, Icons.strikethrough_s, Icons.style, Icons.subdirectory_arrow_left, Icons.subdirectory_arrow_right, Icons.subject, Icons.subscriptions, Icons.subtitles, Icons.subway, Icons.supervised_user_circle, Icons.supervisor_account, Icons.surround_sound, Icons.swap_calls, Icons.swap_horiz, Icons.swap_horizontal_circle, Icons.swap_vert, Icons.swap_vertical_circle, Icons.switch_camera, Icons.switch_video, Icons.sync, Icons.sync_disabled, Icons.sync_problem, Icons.system_update, Icons.system_update_alt, Icons.tab, Icons.tab_unselected, Icons.table_chart, Icons.tablet, Icons.tablet_android, Icons.tablet_mac, Icons.tag_faces, Icons.tap_and_play, Icons.terrain, Icons.text_fields, Icons.text_format, Icons.text_rotate_up, Icons.text_rotate_vertical, Icons.text_rotation_angledown, Icons.text_rotation_angleup, Icons.text_rotation_down, Icons.text_rotation_none, Icons.textsms, Icons.texture, Icons.theaters, Icons.thumb_down, Icons.thumb_up, Icons.thumbs_up_down, Icons.time_to_leave, Icons.timelapse, Icons.timeline, Icons.timer, Icons.timer_10, Icons.timer_3, Icons.timer_off, Icons.title, Icons.toc, Icons.today, Icons.toll, Icons.tonality, Icons.touch_app, Icons.toys, Icons.track_changes, Icons.traffic, Icons.train, Icons.tram, Icons.transfer_within_a_station, Icons.transform, Icons.transit_enterexit, Icons.translate, Icons.trending_down, Icons.trending_flat, Icons.trending_up, Icons.trip_origin, Icons.tune, Icons.turned_in, Icons.turned_in_not, Icons.tv, Icons.unarchive, Icons.undo, Icons.unfold_less, Icons.unfold_more, Icons.update, Icons.usb, Icons.verified_user, Icons.vertical_align_bottom, Icons.vertical_align_center, Icons.vertical_align_top, Icons.vibration, Icons.video_call, Icons.video_label, Icons.video_library, Icons.videocam, Icons.videocam_off, Icons.videogame_asset, Icons.view_agenda, Icons.view_array, Icons.view_carousel, Icons.view_column, Icons.view_comfy, Icons.view_compact, Icons.view_day, Icons.view_headline, Icons.view_list, Icons.view_module, Icons.view_quilt, Icons.view_stream, Icons.view_week, Icons.vignette, Icons.visibility, Icons.visibility_off, Icons.voice_chat, Icons.voicemail, Icons.volume_down, Icons.volume_mute, Icons.volume_off, Icons.volume_up, Icons.vpn_key, Icons.vpn_lock, Icons.wallpaper, Icons.warning, Icons.watch, Icons.watch_later, Icons.wb_auto, Icons.wb_cloudy, Icons.wb_incandescent, Icons.wb_iridescent, Icons.wb_sunny, Icons.wc, Icons.web, Icons.web_asset, Icons.weekend, Icons.whatshot, Icons.widgets, Icons.wifi, Icons.wifi_lock, Icons.wifi_tethering, Icons.work, Icons.wrap_text, Icons.youtube_searched_for, Icons.zoom_in, Icons.zoom_out, Icons.zoom_out_map, ]; IconPicker({ @required this.currentIconData, @required this.onIconChanged, Color highlightColor, Color unHighlightColor, }) : this.highlightColor = highlightColor ?? Colors.blueGrey, this.unHighlightColor = unHighlightColor ?? Colors.blueGrey; @override IconPickerState createState() => IconPickerState(); } class IconPickerState extends State<IconPicker> { IconData selectedIconData; @override void initState() { super.initState(); selectedIconData = widget.currentIconData; } @override Widget build(BuildContext context) { Orientation orientation = MediaQuery.of(context).orientation; return Container( width: 300.0, height: orientation == Orientation.portrait ? 360.0 : 200.0, child: GridView.builder( itemBuilder: (BuildContext context, int index) { var iconData = widget.icons[index]; return Material( color: Colors.transparent, child: InkWell( onTap: (){ setState(() { selectedIconData = iconData; }); widget.onIconChanged(iconData); }, borderRadius: BorderRadius.circular(32), child: TodoBadge( id: iconData.hashCode.toString(), codePoint: iconData.codePoint, color: widget.highlightColor, outlineColor: iconData == selectedIconData ? widget.highlightColor : null, size: 32.0, ), ), ); }, gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: orientation == Orientation.portrait ? 4 : 6, mainAxisSpacing: 8.0, crossAxisSpacing: 8.0, childAspectRatio: 1.0, ), itemCount: widget.icons.length, ), ); } }
0
mirrored_repositories/Todo_Flutter/todo/lib/widgets
mirrored_repositories/Todo_Flutter/todo/lib/widgets/task_progress_indicator/widget.dart
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class TaskProgressIndicator extends StatelessWidget { final Color color; final progress; final _height = 3.0; TaskProgressIndicator({ @required this.color, @required this.progress }); @override Widget build(BuildContext context) { return Row( children: <Widget>[ Expanded( child: LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) { return Stack( children: <Widget>[ Container( height: _height, color: Colors.grey.withOpacity(0.1), ), AnimatedContainer( duration: Duration(milliseconds: 300), width: (progress / 100) * constraints.maxWidth, height: _height, color: color, ), ], ); } ), ), Container( margin: EdgeInsets.only(left: 8.0), child: Text( "$progress%", style: Theme.of(context).textTheme.caption, ), ) ], ); } }
0
mirrored_repositories/Todo_Flutter/todo/lib/widgets
mirrored_repositories/Todo_Flutter/todo/lib/widgets/gradient_background/widget.dart
import 'package:flutter/material.dart'; class GradientBackground extends StatelessWidget { final Widget child; final Color color; GradientBackground({@required this.child, @required this.color}); @override Widget build(BuildContext context) { return AnimatedContainer( decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment.topRight, end: Alignment.bottomLeft, colors: getColorList(color), ) ), curve: Curves.linear, child: child, duration: Duration(microseconds: 500), ); } List<Color> getColorList(Color color) { if (color is MaterialColor) { return [ color[300], color[600], color[700], color[900] ]; } else { return List<Color>.filled(4, color); } } }
0
mirrored_repositories/Todo_Flutter/todo/lib/widgets
mirrored_repositories/Todo_Flutter/todo/lib/widgets/todo_badge/widget.dart
import 'package:flutter/material.dart'; class TodoBadge extends StatelessWidget { final int codePoint; final String id; final Color color; final Color outlineColor; final double size; TodoBadge({ @required this.codePoint, @required this.id, @required this.color, Color outlineColor, this.size }) : this.outlineColor = outlineColor ?? Colors.grey.shade200; Widget build(BuildContext context) { return Hero( tag: id, child: Container( padding: EdgeInsets.all(8.0), decoration: BoxDecoration( shape: BoxShape.circle, border: Border.all(color: outlineColor) ), child: Icon( IconData( codePoint, fontFamily: 'MaterialIcons' ), color: color, size: size, ), ), ); } }
0
mirrored_repositories/Todo_Flutter/todo/lib/widgets
mirrored_repositories/Todo_Flutter/todo/lib/widgets/task_card/widget.dart
import 'package:flutter/material.dart'; import 'package:todo/model/hero_id_model.dart'; import 'package:todo/model/task_model.dart'; import 'package:todo/pages/detail_screen.dart'; import 'package:todo/route/scale_route.dart'; import 'package:todo/utils/color_utils.dart'; import 'package:todo/widgets/task_progress_indicator/widget.dart'; import 'package:todo/widgets/todo_badge/widget.dart'; class TaskCard extends StatelessWidget { final Task task; final Color color; final HeroId heroId; final int totalTodos; final int taskProgress; final GlobalKey backdropKey; TaskCard({ @required this.task, @required this.color, @required this.heroId, @required this.totalTodos, @required this.taskProgress, @required this.backdropKey, }); @override Widget build(BuildContext context) { return GestureDetector( onTap: () { final RenderBox renderBox = backdropKey.currentContext.findRenderObject(); var backDropHeight = renderBox.size.height; var bottomOffset = 60.0; var horizontalOffset = 52.0; var rect = RelativeRect.fromLTRB(horizontalOffset, MediaQuery.of(context).size.height - backDropHeight, horizontalOffset, bottomOffset); Navigator.push( context, ScaleRoute( rect: rect, widget: DetailScreen( taskId: task.id, heroId: heroId, ), )); }, child: Card( shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16.0)), color: Colors.white, elevation: 4.0, margin: EdgeInsets.symmetric(vertical: 16.0, horizontal: 8.0), child: Padding( padding: EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.end, children: [ TodoBadge( id: heroId.codePointId, codePoint: task.codePoint, color: ColorUtils.getColorFrom(task.color), ), Spacer(flex: 8), Container( margin: EdgeInsets.only(bottom: 4.0), child: Hero( tag: heroId.remainingTaskId, child: Text( "$totalTodos Task", style: Theme.of(context) .textTheme .body1 .copyWith(color: Colors.grey[500]), ), ), ), Hero( tag: heroId.nameId, child: Text( task.name, style: Theme.of(context) .textTheme .title .copyWith(color: Colors.black54), ), ), Spacer(), Hero( tag: heroId.progressId, child: TaskProgressIndicator( color: color, progress: taskProgress, ), ) ], ), ), ), ); } }
0
mirrored_repositories/Todo_Flutter/todo/lib/widgets
mirrored_repositories/Todo_Flutter/todo/lib/widgets/icon_picker_builder/widget.dart
import 'package:flutter/material.dart'; import 'package:todo/widgets/icon_picker/widget.dart'; import 'package:todo/widgets/todo_badge/widget.dart'; class IconPickerBuilder extends StatelessWidget { final IconData iconData; final ValueChanged<IconData> onIconChanged; final Color highlightColor; IconPickerBuilder( {@required this.iconData, @required this.onIconChanged, Color highlightColor}) : this.highlightColor = highlightColor; @override Widget build(BuildContext context) { return ClipOval( child: Container( height: 40.0, width: 40.0, child: Material( child: InkWell( onTap: () { showDialog( context: context, builder: (BuildContext context) { return AlertDialog( title: Text('Select an icon'), content: SingleChildScrollView( child: IconPicker( currentIconData: iconData, onIconChanged: onIconChanged, highlightColor: highlightColor), ), ); }); }, child: TodoBadge( id: 'id', codePoint: iconData.codePoint, color: highlightColor, size: 24, ), ), ), ), ); } }
0
mirrored_repositories/Todo_Flutter/todo/lib/widgets
mirrored_repositories/Todo_Flutter/todo/lib/widgets/add_page_card/widget.dart
import 'package:flutter/material.dart'; import 'package:todo/pages/page_path.dart'; class AddPageCard extends StatelessWidget { final Color color; const AddPageCard({Key key, this.color = Colors.black}) : super(key: key); @override Widget build(BuildContext context) { return Card( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16.0), ), elevation: 4.0, margin: EdgeInsets.symmetric(vertical: 16.0, horizontal: 8.0), child: Material( borderRadius: BorderRadius.circular(16.0), color: Colors.white, child: InkWell( onTap: () { Navigator.of(context).pushNamed(PagePath.addCardPage); }, child: Padding( padding: EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Icon( Icons.add, size: 52.0, color: color, ), Container( height: 8.0, ), Text( 'Add Category', style: TextStyle(color: color), ) ], ), ), ))); } }
0
mirrored_repositories/Todo_Flutter/todo/lib/widgets
mirrored_repositories/Todo_Flutter/todo/lib/widgets/color_picker_builder/widget.dart
import 'package:flutter/material.dart'; import 'package:flutter_colorpicker/block_picker.dart'; import 'package:todo/utils/color_utils.dart'; class ColorPickerBuilder extends StatelessWidget { final Color color; final ValueChanged<Color> onColorChanged; ColorPickerBuilder({@required this.color, @required this.onColorChanged}); @override Widget build(BuildContext context) { return ClipOval( child: Container( width: 32.0, height: 32.0, child: Material( color: color, child: InkWell( onTap: () { showDialog( context: context, builder: (BuildContext context) { return AlertDialog( title: Text('Select a color'), content: SingleChildScrollView( child: BlockPicker( availableColors: ColorUtils.defaultColors, pickerColor: color, onColorChanged: onColorChanged, ), ), ); } ); }, ), ) ) ); } }
0
mirrored_repositories/Todo_Flutter/todo/lib
mirrored_repositories/Todo_Flutter/todo/lib/db/db_provider.dart
import 'dart:io'; import 'package:sqflite/sqflite.dart'; import 'package:path/path.dart' as p; import 'package:path_provider/path_provider.dart'; import 'package:todo/model/task_model.dart'; import 'package:todo/model/todo_model.dart'; // import 'dart:io'; class DBProvider { static Database _database; DBProvider._(); static final DBProvider db = DBProvider._(); Future<Database> get database async { if (_database != null) return _database; _database = await initDB(); return _database; } get _dbPath async { String documentsDirectory = await _localPath; return p.join(documentsDirectory, "Todo.db"); } Future<bool> dbExits() async { return File(await _dbPath).exists(); } Future<List<Task>> getAllTask() async { final db = await database; var result = await db.query('Task'); return result.map((t) => Task.fromJson(t)).toList(); } Future<List<Todo>> getAllTodo() async { final db = await database; var result = await db.query('Todo'); return result.map((t) => Todo.fromJson(t)).toList(); } Future<int> insertTask(Task task) async { final db = await database; return db.insert('Task', task.toJson()); } Future<int> insertTodo(Todo todo) async { final db = await database; return db.insert('Todo', todo.toJson()); } Future<void> removeTask(Task task) async { final db = await database; return db.transaction<void>((txn) async { await txn.delete('Todo', where: 'parent = ?', whereArgs: [task.id]); await txn.delete('Task', where: 'id = ?', whereArgs: [task.id]); }); } Future<int> removeTodo(Todo todo) async { final db = await database; return db.delete('Todo', where: 'id = ?', whereArgs: [todo.id]); } Future<int> updateTodo(Todo todo) async { final db = await database; return db.update('Todo', todo.toJson(), where: 'id = ?', whereArgs: [todo.id]); } Future<String> get _localPath async { final directory = await getApplicationDocumentsDirectory(); return directory.path; } initDB() async { String path = await _dbPath; return await openDatabase(path, version:1, onOpen: (db) { }, onCreate: (Database db, int version) async { print("DBProvider:: onCreate()"); await db.execute("CREATE TABLE Task (" "id TEXT PRIMARY KEY," "name TEXT," "color INTEGER," "code_point INTEGER" ")"); await db.execute("CREATE TABLE Todo (" "id TEXT PRIMARY KEY," "name TEXT," "parent INTEGER," "completed INTEGER NOT NULL DEFAULT 0" ")"); }); } closeDB() { if (_database != null) { _database.close(); } } }
0