repo_id
stringlengths 21
168
| file_path
stringlengths 36
210
| content
stringlengths 1
9.98M
| __index_level_0__
int64 0
0
|
---|---|---|---|
mirrored_repositories/flutter-tutorials/projects/counterapp | mirrored_repositories/flutter-tutorials/projects/counterapp/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:counterapp/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/flutter-tutorials/projects/getx_management | mirrored_repositories/flutter-tutorials/projects/getx_management/lib/second_page.dart | import 'package:flutter/material.dart';
class SecondPage extends StatelessWidget {
const SecondPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Counter App Screen 2'),
),
body: const Center(
child: Text(
'Second Page',
style: TextStyle(fontSize: 50),
),
),
);
}
}
| 0 |
mirrored_repositories/flutter-tutorials/projects/getx_management | mirrored_repositories/flutter-tutorials/projects/getx_management/lib/main.dart | import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'second_page.dart';
main() {
runApp(App());
}
class App extends StatelessWidget {
RxInt num = 0.obs;
App({super.key});
@override
Widget build(BuildContext context) {
return GetMaterialApp(
debugShowCheckedModeBanner: false,
title: 'Getx',
themeMode: ThemeMode.system,
theme: ThemeData(
primarySwatch: Colors.blue,
brightness: Brightness.light,
),
darkTheme: ThemeData(
primarySwatch: Colors.blue,
brightness: Brightness.dark,
),
home: Scaffold(
appBar: AppBar(
title: const Text('Counter App Screen 1'),
actions: [
// Switch theme using GetX
IconButton(
onPressed: () {
Get.changeThemeMode(
Get.isDarkMode ? ThemeMode.light : ThemeMode.dark,
);
},
icon: const Icon(Icons.lightbulb),
),
IconButton(
onPressed: () {
Get.to(
const SecondPage(),
arguments: num,
);
},
icon: const Icon(Icons.arrow_forward),
),
],
),
body: Center(
child: Column(
children: [
Obx(() => Text(
num.toString(),
style: const TextStyle(fontSize: 50),
)),
const Padding(
padding: EdgeInsets.all(18.0),
child: TextField(
// obscureText: true,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: 'Password',
),
),
)
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: () {
num++;
// print(num);
},
child: const Icon(Icons.add),
),
),
);
}
}
| 0 |
mirrored_repositories/flutter-tutorials/projects/getx_management | mirrored_repositories/flutter-tutorials/projects/getx_management/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:getx_management/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/flutter-tutorials/projects/applayout | mirrored_repositories/flutter-tutorials/projects/applayout/lib/main.dart | import 'package:flutter/material.dart';
import 'home.dart';
void main(List<String> args) {
runApp(const App());
}
class App extends StatelessWidget {
const App({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Layout',
theme: ThemeData(
primarySwatch: Colors.red,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: const Home() ,
);
}
}
| 0 |
mirrored_repositories/flutter-tutorials/projects/applayout | mirrored_repositories/flutter-tutorials/projects/applayout/lib/home.dart | import 'package:flutter/material.dart';
class Home extends StatelessWidget {
const Home({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: SingleChildScrollView(
child: Column(
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
Container(
width: 100,
height: 100,
color: Colors.amber.shade100,
),
Container(
width: 100,
height: 100,
color: Colors.amber.shade200,
),
Container(
width: 100,
height: 100,
color: Colors.amber.shade300,
),
Container(
width: 100,
height: 100,
color: Colors.amber.shade400,
),
Container(
width: 100,
height: 100,
color: Colors.amber.shade500,
),
Container(
width: 100,
height: 100,
color: Colors.amber.shade600,
),
Container(
width: 100,
height: 100,
color: Colors.amber.shade700,
),
Container(
width: 100,
height: 100,
color: Colors.amber.shade800,
),
],
),
),
Container(
height: 100,
width: double.infinity,
color: Colors.red.shade100,
),
Container(
height: 100,
width: double.infinity,
color: Colors.red.shade200,
),
Container(
height: 100,
width: double.infinity,
color: Colors.red.shade300,
),
Container(
height: 100,
width: double.infinity,
color: Colors.red.shade400,
),
Container(
height: 100,
width: double.infinity,
color: Colors.red.shade500,
),
Container(
height: 100,
width: double.infinity,
color: Colors.red.shade600,
),
Container(
height: 100,
width: double.infinity,
color: Colors.red.shade700,
),
Container(
height: 100,
width: double.infinity,
color: Colors.red.shade800,
),
Container(
height: 100,
width: double.infinity,
color: Colors.red.shade900,
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/flutter-tutorials/projects/applayout | mirrored_repositories/flutter-tutorials/projects/applayout/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:applayout/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const App());
// 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/flutter-tutorials/projects/navigation | mirrored_repositories/flutter-tutorials/projects/navigation/lib/app.dart | import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:navigation/Screens/login.dart';
import 'Screens/home.dart';
class App extends StatefulWidget {
const App({super.key});
@override
State<App> createState() => _AppState();
}
class _AppState extends State<App> {
@override
Widget build(BuildContext context) {
return GetMaterialApp(
debugShowCheckedModeBanner: false,
title: 'Navifation App',
// Initial Route
initialRoute: '/',
// Routes
routes: {
'/': (context) => const Login(),
'/home': (context) => const Home(),
},
// Theme Mode
// themeMode: ThemeMode.system,
theme: ThemeData(
primarySwatch: Colors.red,
brightness: Brightness.light,
),
darkTheme: ThemeData(
primarySwatch: Colors.pink,
brightness: Brightness.dark,
appBarTheme: const AppBarTheme(
color: Colors.pink,
)),
//? home: const Login(),
);
}
}
| 0 |
mirrored_repositories/flutter-tutorials/projects/navigation | mirrored_repositories/flutter-tutorials/projects/navigation/lib/main.dart | import 'package:flutter/material.dart';
import 'app.dart';
void main(List<String> args) {
runApp(const App());
}
| 0 |
mirrored_repositories/flutter-tutorials/projects/navigation/lib | mirrored_repositories/flutter-tutorials/projects/navigation/lib/Functions/switch_theme.dart | // Switch Theme Function in Dart
import 'package:flutter/material.dart';
import 'package:get/get.dart';
/// Switch Theme Function
void switchTheme(BuildContext context) {
// Switch Theme Mode using Getx
Get.changeThemeMode(
Get.isDarkMode ? ThemeMode.light : ThemeMode.dark,
);
}
| 0 |
mirrored_repositories/flutter-tutorials/projects/navigation/lib | mirrored_repositories/flutter-tutorials/projects/navigation/lib/Screens/login.dart | import 'package:flutter/material.dart';
import '../Functions/switch_theme.dart';
class Login extends StatefulWidget {
const Login({super.key});
@override
State<Login> createState() => _LoginState();
}
class _LoginState extends State<Login> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Login'),
actions: [
// Switch Theme Button
IconButton(
onPressed: () {
// Switch Theme
setState(() {
switchTheme(context);
});
},
icon: const Icon(Icons.light_mode),
),
],
),
body: Center(
child: ElevatedButton(
onPressed: () {
Navigator.pushNamed(context, '/home');
},
child: const Text('Login'),
),
),
);
}
}
| 0 |
mirrored_repositories/flutter-tutorials/projects/navigation/lib | mirrored_repositories/flutter-tutorials/projects/navigation/lib/Screens/home.dart | import 'package:flutter/material.dart';
import '../Functions/switch_theme.dart';
class Home extends StatefulWidget {
const Home({super.key});
@override
State<Home> createState() => _HomeState();
}
class _HomeState extends State<Home> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Home'),
actions: [
// Switch Theme Button
IconButton(
onPressed: () {
// Switch Theme
setState(() {
switchTheme(context);
});
},
icon: const Icon(Icons.light_mode),
),
],
),
body: Center(
child: ElevatedButton(
onPressed: () {
Navigator.pop(context);
//! Navigator.pushNamed(context, '/');
},
child: const Text('Logout'),
),
),
);
}
}
| 0 |
mirrored_repositories/flutter-tutorials/projects/navigation | mirrored_repositories/flutter-tutorials/projects/navigation/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:navigation/app.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const App());
// 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/flutter-tutorials/projects/flutter_stateful_widget | mirrored_repositories/flutter-tutorials/projects/flutter_stateful_widget/lib/main.dart | import 'package:flutter/material.dart';
main() => runApp(App());
class App extends StatefulWidget {
App({super.key});
@override
State<App> createState() => _AppState();
}
class _AppState extends State<App> {
int num = 0;
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
appBar: AppBar(
title: const Text('Flutter Counter App'),
),
body: Center(
child: Text(
num.toString(),
style: const TextStyle(
fontSize: 100.0,
fontWeight: FontWeight.bold,
),
),
),
floatingActionButton: FloatingActionButton(
onPressed: () {
setState(() => num++);
// setState((){
// Body of setState is executed first
// });
print('The value of num is $num');
},
child: const Icon(Icons.add),
),
),
);
}
}
| 0 |
mirrored_repositories/flutter-tutorials/projects/form_validation | mirrored_repositories/flutter-tutorials/projects/form_validation/lib/main.dart | import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
void main(List<String> args) {
runApp(const FormValidation());
}
class FormValidation extends StatefulWidget {
const FormValidation({super.key});
@override
State<FormValidation> createState() => _FormValidationState();
}
class _FormValidationState extends State<FormValidation> {
// Create a global key that uniquely identifies the Form widget
// and allows validation of the form.
//
// Note: This is a `GlobalKey<FormState>`,
// not a GlobalKey<MyCustomFormState>.
final _formKey = GlobalKey<FormState>();
String inputText = 'Form Validation';
@override
Widget build(BuildContext context) {
return GetMaterialApp(
debugShowCheckedModeBanner: false,
title: 'Form Validation',
theme: ThemeData(
primarySwatch: Colors.teal,
),
home: Scaffold(
appBar: AppBar(
title: Text(inputText),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Form(
// Set the form to the global key we created above
key: _formKey,
child: TextFormField(
keyboardType: TextInputType.url,
inputFormatters: [
FilteringTextInputFormatter.deny(RegExp(r'\s'))
],
// Label
decoration: const InputDecoration(
hintText: 'This is a hint text',
helperText: 'This is a helper text',
labelText: 'This is label text',
border: OutlineInputBorder(),
),
// URL Validation
validator: (value) {
if (value!.isEmpty) {
return '*Required';
} else if (!value.startsWith('http')) {
return 'Please enter valid URL';
}
return null;
},
onChanged: (value) {
setState(() {
inputText = value;
});
},
),
),
Padding(
padding: const EdgeInsets.all(18.0),
child: ElevatedButton(
onPressed: () {
// Validate returns true if the form is valid, or false
// otherwise.
// get snackbar
if (_formKey.currentState!.validate()) {
Get.snackbar(
'Form Validation',
'Form is valid',
snackPosition: SnackPosition.BOTTOM,
backgroundColor: Colors.green,
colorText: Colors.white,
);
} else {
Get.snackbar(
'Form Validation',
'Form is invalid',
snackPosition: SnackPosition.BOTTOM,
backgroundColor: Colors.red,
colorText: Colors.white,
);
}
},
child: const Text('Submit'),
),
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/flutter-tutorials/projects/form_validation | mirrored_repositories/flutter-tutorials/projects/form_validation/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:form_validation/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const FormValidation());
// 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/flutter-tutorials/projects/scroll_view | mirrored_repositories/flutter-tutorials/projects/scroll_view/lib/main.dart | import 'package:flutter/material.dart';
void main() => runApp(const App());
class App extends StatelessWidget {
const App({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Scrollable',
theme: ThemeData(
primarySwatch: Colors.purple,
),
home: Scaffold(
appBar: AppBar(
title: const Text('Flutter Scrollable'),
),
body: SingleChildScrollView(
child: Column(
children: [
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
for (var i = 0; i < 20; i++)
const Padding(
padding: EdgeInsets.all(8.0),
child: Icon(Icons.person),
)
],
),
),
for (var i = 0; i < 20; i++)
const Padding(
padding: EdgeInsets.only(top: 8.0),
child: Card(
elevation: 5.0,
child: ListTile(
leading: Icon(Icons.person),
title: Text('Usama Sarwar'),
subtitle: Text('+92 310 000 777 3'),
),
),
),
],
),
),
),
);
}
}
| 0 |
mirrored_repositories/flutter-tutorials/projects/scroll_view | mirrored_repositories/flutter-tutorials/projects/scroll_view/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:scroll_view/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/flutter-tutorials/projects/column_rows | mirrored_repositories/flutter-tutorials/projects/column_rows/lib/main.dart | import 'package:flutter/material.dart';
void main() => runApp(const App());
class App extends StatelessWidget {
const App({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Column and Rows',
theme: ThemeData(
primarySwatch: Colors.red,
),
home: Scaffold(
appBar: AppBar(
title: const Text('Flutter Column and Rows'),
),
body: Column(
children: [
const Padding(
padding: EdgeInsets.all(10.0),
child: Text('MainAxisAlignment.start'),
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Container(
color: Colors.red,
width: 100,
height: 100,
),
Container(
color: Colors.green,
width: 100,
height: 100,
),
Container(
color: Colors.blue,
width: 100,
height: 100,
),
],
),
const Padding(
padding: EdgeInsets.all(10.0),
child: Text('MainAxisAlignment.end'),
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Container(
color: Colors.red,
width: 100,
height: 100,
),
Container(
color: Colors.green,
width: 100,
height: 100,
),
Container(
color: Colors.blue,
width: 100,
height: 100,
),
],
),
const Padding(
padding: EdgeInsets.all(10.0),
child: Text('MainAxisAlignment.center'),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
color: Colors.red,
width: 100,
height: 100,
),
Container(
color: Colors.green,
width: 100,
height: 100,
),
Container(
color: Colors.blue,
width: 100,
height: 100,
),
],
),
const Padding(
padding: EdgeInsets.all(10.0),
child: Text('MainAxisAlignment.spaceBetween'),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
color: Colors.red,
width: 100,
height: 100,
),
Container(
color: Colors.green,
width: 100,
height: 100,
),
Container(
color: Colors.blue,
width: 100,
height: 100,
),
],
),
const Padding(
padding: EdgeInsets.all(10.0),
child: Text('MainAxisAlignment.spaceAround'),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Container(
color: Colors.red,
width: 100,
height: 100,
),
Container(
color: Colors.green,
width: 100,
height: 100,
),
Container(
color: Colors.blue,
width: 100,
height: 100,
),
],
),
const Padding(
padding: EdgeInsets.all(10.0),
child: Text('MainAxisAlignment.spaceEvenly'),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Container(
color: Colors.red,
width: 100,
height: 100,
),
Container(
color: Colors.green,
width: 100,
height: 100,
),
Container(
color: Colors.blue,
width: 100,
height: 100,
),
],
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/flutter-tutorials/projects/column_rows | mirrored_repositories/flutter-tutorials/projects/column_rows/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:column_rows/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/flutter-tutorials/projects/helloworld | mirrored_repositories/flutter-tutorials/projects/helloworld/lib/main.dart | // ignore_for_file: prefer_const_constructors
import 'package:flutter/material.dart';
main() {
runApp(
MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
appBar: AppBar(
centerTitle: true,
title: Text('AppBar Title'),
),
body: Center(
child: Text('Hello World'),
),
),
),
);
}
| 0 |
mirrored_repositories/flutter-tutorials/projects/helloworld | mirrored_repositories/flutter-tutorials/projects/helloworld/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:helloworld/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/flutter-tutorials/projects/flutter_state | mirrored_repositories/flutter-tutorials/projects/flutter_state/lib/main.dart | import 'package:flutter/material.dart';
void main(List<String> args) {
runApp(const StatefulApp());
// runApp(const StatelessApp()); // Stateless Widget
}
class StatefulApp extends StatefulWidget {
const StatefulApp({super.key});
@override
State<StatefulApp> createState() => _StatefulAppState();
}
class _StatefulAppState extends State<StatefulApp> {
static int count = 0;
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Counter App'),
centerTitle: true,
backgroundColor: Colors.red[600],
),
body: Center(
child: Text(
count.toString(),
style: TextStyle(
fontSize: 100.0,
// fontWeight: FontWeight.bold,
letterSpacing: 2.0,
color: Colors.grey[900],
fontFamily: 'IndieFlower',
),
),
),
floatingActionButton: FloatingActionButton(
onPressed: () {
setState(() {
count++;
});
},
backgroundColor: Colors.red[600],
child: const Icon(Icons.add),
),
),
);
}
}
// Stateless Widget Example
// class StatelessApp extends StatelessWidget {
// static int count = 0;
// const StatelessApp({super.key});
// @override
// Widget build(BuildContext context) {
// return MaterialApp(
// home: Scaffold(
// appBar: AppBar(
// title: const Text('Counter App'),
// centerTitle: true,
// backgroundColor: Colors.red[600],
// ),
// body: Center(
// child: Text(
// count.toString(),
// style: TextStyle(
// fontSize: 100.0,
// // fontWeight: FontWeight.bold,
// letterSpacing: 2.0,
// color: Colors.grey[900],
// fontFamily: 'IndieFlower',
// ),
// ),
// ),
// floatingActionButton: FloatingActionButton(
// onPressed: () {
// count++;
// print(count);
// },
// backgroundColor: Colors.red[600],
// child: const Icon(Icons.add),
// ),
// ),
// );
// }
// }
| 0 |
mirrored_repositories/flutter-tutorials/projects/flutter_state | mirrored_repositories/flutter-tutorials/projects/flutter_state/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_state/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/flutter-tutorials/projects/list_view_builder | mirrored_repositories/flutter-tutorials/projects/list_view_builder/lib/app.dart | import 'package:flutter/material.dart';
import 'contact_details.dart';
import 'contacts.dart';
class App extends StatefulWidget {
const App({super.key});
@override
State<App> createState() => _AppState();
}
class _AppState extends State<App> {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Contacts App',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Scaffold(
appBar: AppBar(
title: const Text('Contacts'),
centerTitle: true,
),
body: ListView.builder(
itemCount: contacts.length,
itemBuilder: (context, index) {
return ListTile(
leading: CircleAvatar(
child: Text(contacts.keys.elementAt(index)[0]),
),
title: Text(contacts.keys.elementAt(index)),
subtitle: Text(contacts.values.elementAt(index)),
trailing: Row(
mainAxisAlignment: MainAxisAlignment.end,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
// info button
IconButton(
icon: const Icon(Icons.info),
onPressed: () {
// Navigate to Contact Details
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ContactDetails(
name: contacts.keys.elementAt(index),
number: contacts.values.elementAt(index),
),
),
);
},
),
IconButton(
icon: const Icon(Icons.call),
onPressed: () {
// Snackbar Calling Specific Contact
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
'Calling ${contacts.keys.elementAt(index)}...'),
duration: const Duration(seconds: 5),
),
);
},
),
],
),
);
},
),
),
);
}
}
| 0 |
mirrored_repositories/flutter-tutorials/projects/list_view_builder | mirrored_repositories/flutter-tutorials/projects/list_view_builder/lib/contacts.dart | // 30 Random Contcats
Map<String, String> contacts = {
'Usama Sarwar': '+923100007773',
'Muhammad Ali': '+923100007774',
'Ayesha Ali': '+923100007775',
'Jessica Gill': '+923100007776',
'Sara Ali': '+923100007777',
'Mili Ahmed': '+923100007778',
'Sara Khan': '+923100007779',
'Khan Azam': '+923100007780',
'Sanam Khan': '+923100007781',
'Sara Khanum': '+923100007782',
'Sara Khani': '+923100007783',
};
| 0 |
mirrored_repositories/flutter-tutorials/projects/list_view_builder | mirrored_repositories/flutter-tutorials/projects/list_view_builder/lib/contact_details.dart | import 'package:flutter/material.dart';
class ContactDetails extends StatefulWidget {
final String name;
final String number;
const ContactDetails({super.key, required this.name, required this.number});
@override
State<ContactDetails> createState() => _ContactDetailsState();
}
class _ContactDetailsState extends State<ContactDetails> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.name),
centerTitle: true,
),
body: Center(
child: Text(widget.number),
),
);
}
}
| 0 |
mirrored_repositories/flutter-tutorials/projects/list_view_builder | mirrored_repositories/flutter-tutorials/projects/list_view_builder/lib/main.dart | import 'package:flutter/material.dart';
import 'app.dart';
void main(List<String> args) {
runApp(const App());
}
| 0 |
mirrored_repositories/flutter-tutorials/projects/list_view_builder | mirrored_repositories/flutter-tutorials/projects/list_view_builder/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:list_view_builder/app.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const App());
// 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/flutter-tutorials/projects/dark_mode_app | mirrored_repositories/flutter-tutorials/projects/dark_mode_app/lib/main.dart | import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'SAU',
theme: ThemeData(
// This is the theme of your application.
//
// TRY THIS: Try running your application with "flutter run". You'll see
// the application has a blue toolbar. Then, without quitting the app,
// try changing the seedColor in the colorScheme below to Colors.green
// and then invoke "hot reload" (save your changes or press the "hot
// reload" button in a Flutter-supported IDE, or press "r" if you used
// the command line to start the app).
//
// Notice that the counter didn't reset back to zero; the application
// state is not lost during the reload. To reset the state, use hot
// restart instead.
//
// This works for code too, not just values: Most code changes can be
// tested with just a hot reload.
// colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
brightness: Brightness.dark,
),
home: const MyHomePage(title: 'Sindh Agriculture University'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
// 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
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 500;
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(
// TRY THIS: Try changing the color here to a specific color (to
// Colors.amber, perhaps?) and trigger a hot reload to see the AppBar
// change color while the other colors stay the same.
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
// 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.
//
// 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).
//
// TRY THIS: Invoke "debug painting" (choose the "Toggle Debug Paint"
// action in the IDE, or press "p" in the console), to see the
// wireframe for each widget.
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headlineMedium,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
| 0 |
mirrored_repositories/flutter-tutorials/projects/dark_mode_app | mirrored_repositories/flutter-tutorials/projects/dark_mode_app/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:dark_mode_app/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/flutter-tutorials/GCUH/counter_app | mirrored_repositories/flutter-tutorials/GCUH/counter_app/lib/main.dart | // Material Library: Contains all the Material Design Widgets
import 'package:flutter/material.dart';
// Main Function: Entry Point of the Application
main() {
// runApp: Renders the Widget Tree on the Screen
runApp(
// MaterialApp: Provides the basic app structure
MaterialApp(
// debugShowCheckedModeBanner: Removes the Debug Banner
debugShowCheckedModeBanner: false,
// title: Title of the Application
title: 'Make me rich',
home: Scaffold(
// Scaffold: Provides the basic Material Design Visual Layout Structure
floatingActionButton: FloatingActionButton(
tooltip: 'Add Number', // tooltip: Displays the Tooltip
child: const Icon(Icons.add),
onPressed: () {}, // onPressed: Callback Function
),
appBar: AppBar(
// AppBar: Displays the AppBar on the Screen
centerTitle: true, // centerTitle: Centers the Title
title: const Text(
// Text: Displays the Text on the Screen
'Make me rich',
)),
body: const Center(
// Center: Centers the child widget
// Show some image from picsum or unsplash
child: Image(
// Image: Displays the Image on the Screen
image: NetworkImage(
// NetworkImage: Fetches the Image from the Network
'https://picsum.photos/700/900',
),
)),
),
),
);
}
| 0 |
mirrored_repositories/flutter-tutorials/GCUH/counter_app | mirrored_repositories/flutter-tutorials/GCUH/counter_app/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:counter_app/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/flutter-loginui | mirrored_repositories/flutter-loginui/lib/main.dart | import 'package:flutter/material.dart';
import './Animation/FadeAnimation.dart';
void main() => runApp(
MaterialApp(
home: HomePage(),
debugShowCheckedModeBanner: false,
),
);
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: Color(0xff21254A),
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
height: 200,
child: Stack(
children: <Widget>[
Positioned(
child: FadeAnimation(
1,
Container(
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.cover,
image: AssetImage("assets/images/1.png"),
),
),
),
))
],
),
),
SizedBox(
height: 20,
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
FadeAnimation(
1,
Text(
"Hello there, \nwelcome back",
style: TextStyle(
fontSize: 30,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
SizedBox(
height: 40,
),
FadeAnimation(
1,
Container(
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
color: Colors.transparent,
),
child: Column(
children: <Widget>[
Container(
padding: EdgeInsets.all(10.0),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Colors.grey[100],
),
),
),
child: TextField(
decoration: InputDecoration(
border: InputBorder.none,
hintText: "Username",
hintStyle: TextStyle(color: Colors.grey),
),
),
),
Container(
padding: EdgeInsets.all(10.0),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Colors.grey[100],
),
),
),
child: TextField(
decoration: InputDecoration(
border: InputBorder.none,
hintText: "Password",
hintStyle: TextStyle(color: Colors.grey)),
),
)
],
),
),
),
SizedBox(
height: 20.0,
),
Center(
child: FadeAnimation(
1,
Text(
"Forgot Password?",
style: TextStyle(
color: Colors.pink[200],
),
),
),
),
SizedBox(
height: 20.0,
),
FadeAnimation(
1,
Container(
height: 50,
margin: EdgeInsets.symmetric(horizontal: 60),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50),
color: Color.fromRGBO(49, 39, 79, 1),
),
child: Center(
child: Text(
"Login",
style: TextStyle(color: Colors.white),
),
),
),
),
SizedBox(
height: 20.0,
),
FadeAnimation(
1,
Center(
child: Text(
"Create Account",
style: TextStyle(
color: Colors.pink[200],
),
),
),
),
],
),
)
],
),
);
}
}
| 0 |
mirrored_repositories/flutter-loginui/lib | mirrored_repositories/flutter-loginui/lib/Animation/FadeAnimation.dart | import 'package:flutter/material.dart';
import 'package:simple_animations/simple_animations.dart';
class FadeAnimation extends StatelessWidget {
final double delay;
final Widget child;
FadeAnimation(this.delay, this.child);
@override
Widget build(BuildContext context) {
final tween = MultiTrackTween([
Track("opacity")
.add(Duration(milliseconds: 500), Tween(begin: 0.0, end: 1.0)),
Track("translateY").add(
Duration(milliseconds: 500), Tween(begin: -30.0, end: 0.0),
curve: Curves.easeOut)
]);
return ControlledAnimation(
delay: Duration(milliseconds: (500 * delay).round()),
duration: tween.duration,
tween: tween,
child: child,
builderWithChild: (context, child, animation) => Opacity(
opacity: animation["opacity"],
child: Transform.translate(
offset: Offset(0, animation["translateY"]), child: child),
),
);
}
}
| 0 |
mirrored_repositories/flutter-loginui | mirrored_repositories/flutter-loginui/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:login_ui_1_video/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/Fluttereo/Flutter-UI-Kit/flutter_grocery | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/main.dart | import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/util/Router.dart';
import 'package:flutter_grocery/util/StyleUtil.dart';
import 'package:flutter_grocery/widgets/TextWidget.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: Constant.APP_NAME,
darkTheme: StyleUtil.themeData,
theme: StyleUtil.themeData,
home: SplashWidget(title: Constant.APP_NAME),
routes: Router.getRoutePage(),
debugShowCheckedModeBanner: false,
);
}
}
class SplashWidget extends StatefulWidget {
SplashWidget({Key key, this.title}) : super(key: key);
final String title;
@override
SplashWidgetState createState() => SplashWidgetState();
}
class SplashWidgetState extends State<SplashWidget> {
@override
void initState() {
super.initState();
Timer(
Duration(seconds: 3),
() => Navigator.pushNamedAndRemoveUntil(
context, Router.LANDING, ModalRoute.withName(Router.LANDING)));
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
child: Stack(children: [
Image.asset(
'${Constant.PATH_IMAGE}/grocery.jpg',
fit: BoxFit.cover,
height: double.infinity,
width: double.infinity,
),
Container(
color: Color.fromARGB(150, 0, 0, 0),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'${Constant.PATH_IMAGE}/app_icon.jpg',
width: 120,
height: 120,
),
Padding(
padding: const EdgeInsets.fromLTRB(10, 20, 10, 5),
child: TextWidget(
text: Constant.APP_NAME,
fontColor: Colors.white,
fontSize: Constant.BIG_TEXT_FONT,
fontFamily: Constant.ROBOTO_BOLD,
),
),
TextWidget(
text: Constant.SPLASH_TEXT,
fontColor: Colors.white,
fontSize: Constant.TEXT_FONT,
),
],
),
),
)
]),
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/widgets/NameBottonButton.dart | import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/util/Pallete.dart';
import 'package:flutter_grocery/widgets/TextWidget.dart';
class NameBottonButton extends StatefulWidget {
final String name;
final Function onTabPress;
NameBottonButton({@required this.name, @required this.onTabPress}) : super();
@override
_NameBottonButtonState createState() => _NameBottonButtonState();
}
class _NameBottonButtonState extends State<NameBottonButton> {
@override
Widget build(BuildContext context) {
return Container(
height: Platform.isIOS ? 70 : 50,
padding: EdgeInsets.fromLTRB(
0, 0, 0, Platform.isIOS ? Constant.PADDING_VIEW : 0),
color: Pallete.primaryColor,
child: FlatButton(
onPressed: widget.onTabPress,
child: TextWidget(
text: widget.name,
fontColor: Colors.white,
fontSize: Constant.HINT_TEXT_FONT,
fontFamily: Constant.ROBOTO_MEDIUM,
)),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/widgets/HomeAppBar.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/util/Constant.dart';
// import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/util/Pallete.dart';
import 'package:flutter_grocery/util/Router.dart';
// import 'package:flutter_grocery/util/StyleUtil.dart';
import 'package:flutter_grocery/widgets/TextAppBar.dart';
class HomeAppBar extends AppBar {
final String text;
final bool isCenterTitle;
final BuildContext context;
final int selectedIndex;
HomeAppBar(
{this.text,
this.isCenterTitle,
@required this.context,
this.selectedIndex})
: super();
@override
bool get centerTitle => isCenterTitle;
@override
Color get backgroundColor => Pallete.toolbarColor;
@override
Widget get leading => IconButton(
icon: Image.asset(
'${Constant.PATH_IMAGE}/app_icon.jpg',
// color: Pallete.toolbarItemColor,
width: 32,
),
onPressed: () => {},
);
@override
Widget get title => TextAppBar(
text: text,
);
@override
List<Widget> get actions => [
IconButton(
icon: Icon(
Icons.search,
color: selectedIndex == 0
? Pallete.toolbarItemColor
: Colors.transparent,
size: 26,
),
onPressed: () => {
if (selectedIndex == 0)
Navigator.of(context).pushNamed(Router.SEARCH)
},
),
// IconButton(
// icon: Icon(
// Icons.notification_important,
// color: Pallete.toolbarItemColor,
// size: 26,
// ),
// onPressed: () => {},
// )
];
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/widgets/MainAppBar.dart | import 'package:flutter/material.dart';
// import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/util/Pallete.dart';
import 'package:flutter_grocery/util/Router.dart';
// import 'package:flutter_grocery/util/StyleUtil.dart';
import 'package:flutter_grocery/widgets/TextAppBar.dart';
class MainAppBar extends AppBar {
final String text;
final bool isCenterTitle;
final bool isHideSearch;
final BuildContext context;
MainAppBar(
{this.text,
this.isCenterTitle,
this.isHideSearch,
@required this.context})
: super();
@override
bool get centerTitle => isCenterTitle;
@override
Color get backgroundColor => Pallete.toolbarColor;
@override
Widget get leading => IconButton(
icon: Icon(
Icons.chevron_left,
color: Pallete.toolbarItemColor,
),
onPressed: () {
Navigator.of(context).pop();
},
iconSize: 36,
);
@override
Widget get title => TextAppBar(text: text);
@override
List<Widget> get actions => [
IconButton(
icon: Icon(
Icons.search,
color: isHideSearch != null && isHideSearch
? Colors.transparent
: Pallete.toolbarItemColor,
),
onPressed: () {
if (context != null) Navigator.of(context).pushNamed(Router.SEARCH);
},
iconSize: 26,
),
IconButton(
icon: Icon(
Icons.home,
color: Pallete.toolbarItemColor,
),
onPressed: () {
if (context != null)
Navigator.popUntil(context, ModalRoute.withName(Router.TABS));
},
iconSize: 26,
)
];
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/widgets/TextAppBar.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/util/Pallete.dart';
import 'package:flutter_grocery/widgets/TextWidget.dart';
class TextAppBar extends StatefulWidget {
final String text;
TextAppBar({
Key key,
@required this.text,
}) : super(key: key);
@override
_TextAppBarState createState() => _TextAppBarState();
}
class _TextAppBarState extends State<TextAppBar> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return Material(
color: Colors.transparent,
child: TextWidget(
text: widget.text != null ? widget.text : "",
fontColor: Pallete.toolbarItemColor,
fontSize: Constant.APP_BAR_TEXT_FONT,
fontFamily: Constant.ROBOTO_MEDIUM,
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/widgets/SearchWidget.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/util/Pallete.dart';
import 'package:flutter_grocery/util/StyleUtil.dart';
class SearchWidget extends AppBar {
final Function onPress, onSearch, onClear;
final String textSearch;
SearchWidget({this.textSearch, this.onPress, this.onSearch, this.onClear})
: super();
@override
Color get backgroundColor => Pallete.primaryColor;
@override
Widget get leading => IconButton(
icon: Icon(Icons.chevron_left),
onPressed: () {
onPress();
},
iconSize: 36,
);
@override
Widget get title => Container(
child: Center(
child: TextFormField(
style: StyleUtil.textSearchStyle,
decoration: InputDecoration(
hintText: "Search",
hintStyle: StyleUtil.textSearchHintStyle,
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
errorBorder: InputBorder.none,
disabledBorder: InputBorder.none,
),
cursorColor: Colors.white,
autofocus: true,
onChanged: (data) {
onSearch(data);
},
),
),
);
@override
List<Widget> get actions => [
Padding(
padding: const EdgeInsets.all(Constant.HALF_PADDING_VIEW),
child: IconButton(
icon: Icon(Icons.clear),
onPressed: () {
onClear();
},
iconSize: 26,
),
)
];
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/widgets/TextWidget.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/util/Constant.dart';
class TextWidget extends StatefulWidget {
final String text;
final double fontSize;
final Color fontColor;
final String fontFamily;
final int maxLines;
TextWidget(
{Key key,
@required this.text,
this.fontSize,
this.fontColor,
this.fontFamily,
this.maxLines})
: super(key: key);
@override
_TextWidgetState createState() => _TextWidgetState();
}
class _TextWidgetState extends State<TextWidget> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return Material(
color: Colors.transparent,
child: Text(
widget.text != null ? this.widget.text : "",
maxLines: widget.maxLines != null ? widget.maxLines : null,
textScaleFactor: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: this.widget.fontColor,
fontSize: this.widget.fontSize,
fontFamily: widget.fontFamily == null
? Constant.ROBOTO_REGULAR
: widget.fontFamily),
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/widgets/ButtonWidget.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/util/Constant.dart';
class ButtonWidget extends StatefulWidget {
final String text;
final double fontSize;
final Color fontColor;
final Color buttonColor;
final bool isBorder;
final String fontFamily;
final Function() onPress;
ButtonWidget(
{Key key,
@required this.text,
this.fontSize,
this.fontColor,
this.buttonColor,
this.isBorder,
this.fontFamily,
this.onPress})
: super(key: key);
@override
_ButtonWidgetState createState() => _ButtonWidgetState();
}
class _ButtonWidgetState extends State<ButtonWidget> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return Material(
child: Padding(
padding: const EdgeInsets.fromLTRB(
Constant.PADDING_VIEW, 0, Constant.PADDING_VIEW, 0),
child: SizedBox(
height: Constant.BUTTON_HEIGHT,
child: RaisedButton(
child: Text(
this.widget.text,
style: TextStyle(
color: this.widget.fontColor,
fontSize: this.widget.fontSize,
fontFamily: widget.fontFamily == null
? Constant.ROBOTO_MEDIUM
: Constant.ROBOTO_REGULAR,
),
),
onPressed: this.widget.onPress != null ? this.widget.onPress : () {},
color: widget.buttonColor,
textColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
side: BorderSide(
color: widget.isBorder != null && widget.isBorder
? Colors.grey
: Colors.transparent)),
),
),
));
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/widgets/MainBottonNavBar.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/util/Pallete.dart';
import 'package:flutter_grocery/widgets/TextWidget.dart';
class MainBottomNavBar extends StatefulWidget {
final int selectedIndex;
final Function onTabPress;
MainBottomNavBar({@required this.selectedIndex, @required this.onTabPress})
: super();
@override
_MainBottomNavBarState createState() => _MainBottomNavBarState();
}
class _MainBottomNavBarState extends State<MainBottomNavBar> {
@override
Widget build(BuildContext context) {
return BottomNavigationBar(
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(
Icons.home,
),
title: TextWidget(text: Constant.SHOP)),
BottomNavigationBarItem(
icon: Icon(
Icons.shopping_cart,
),
title: TextWidget(text: Constant.MY_CART)),
BottomNavigationBarItem(
icon: Icon(
Icons.shopping_basket,
),
title: TextWidget(text: Constant.ORDERS)),
BottomNavigationBarItem(
icon: Icon(
Icons.supervisor_account,
),
title: TextWidget(text: Constant.ACCOUNT))
],
currentIndex: widget.selectedIndex,
showSelectedLabels: true,
showUnselectedLabels: false,
// selectedItemColor: Pallete.primaryColor,
selectedLabelStyle: TextStyle(color: Pallete.primaryColor, fontSize: 12),
selectedIconTheme: IconThemeData(size: 30, color: Pallete.primaryColor),
// unselectedItemColor: Pallete.textSubTitle,
unselectedIconTheme: IconThemeData(size: 30, color: Colors.grey[400]),
onTap: widget.onTabPress,
backgroundColor: Colors.white,
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/cart/CartDetailsPage.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/pages/cart/CartView.dart';
import 'package:flutter_grocery/pages/grocery_list/list/GroceryViewHorizontalList.dart';
import 'package:flutter_grocery/pages/modal/Cart.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/util/Helper.dart';
import 'package:flutter_grocery/util/Pallete.dart';
import 'package:flutter_grocery/widgets/TextWidget.dart';
class CartDetailsPage extends StatefulWidget {
@override
_CartDetailsPageState createState() => _CartDetailsPageState();
}
class _CartDetailsPageState extends State<CartDetailsPage> {
final List<Cart> cartList = Helper.getCartDetails();
final List<Cart> cartArray = Helper.getCartDetails();
void modifyQuantity(type, numOfItems, index) {
setState(() {
switch (type) {
case 1:
int price = cartList[index].grocery.price * numOfItems;
cartArray[index].grocery.price = price;
break;
case 0:
int price = cartList[index].grocery.price * numOfItems;
cartArray[index].grocery.price = price;
break;
default:
}
});
}
int getTotalPrice() {
int price = 0;
for (var item in cartArray) {
price += item.grocery.price;
}
return price;
}
@override
Widget build(BuildContext context) {
return Container(
color: Pallete.appBgColor,
height: MediaQuery.of(context).size.height,
child: Stack(
alignment: Alignment.bottomCenter,
children: [
SingleChildScrollView(
padding: EdgeInsets.fromLTRB(0, 0, 0, Constant.MARGIN_50),
child: Column(
children: [
CartView(
listCart: cartArray,
modifyQuantity: modifyQuantity,
),
GroceryViewHorizontalList(
listGrocery: Helper.getVegetableList(),
)
],
),
),
Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Divider(
thickness: 1,
height: 2,
),
Container(
color: Pallete.countViewColor, //0xFFFAFAFA
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.fromLTRB(Constant.HALF_PADDING_VIEW + 5,
Constant.HALF_PADDING_VIEW, 0, Constant.HALF_PADDING_VIEW),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
TextWidget(
text: '${Constant.TOTAL} : ',
fontColor: Pallete.textSubTitle,
fontSize: Constant.HINT_TEXT_FONT,
fontFamily: Constant.ROBOTO_MEDIUM,
),
TextWidget(
text: '${Constant.RUPEE} ${getTotalPrice()}',
fontColor: Colors.black,
fontSize: Constant.APP_BAR_TEXT_FONT,
fontFamily: Constant.ROBOTO_BOLD,
)
],
),
),
Row(
children: [
TextWidget(
text: '${Constant.CHECKOUT}',
fontColor: Colors.black,
fontSize: Constant.HINT_TEXT_FONT,
fontFamily: Constant.ROBOTO_BOLD,
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Icon(
Icons.arrow_forward,
size: 24,
color: Colors.black,
),
)
],
)
],
),
),
],
)
],
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/cart/CartItem.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/pages/grocery_list/detail/AddQuatityView.dart';
import 'package:flutter_grocery/pages/modal/Cart.dart';
import 'package:flutter_grocery/pages/modal/ParamType.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/util/Pallete.dart';
import 'package:flutter_grocery/util/Router.dart';
import 'package:flutter_grocery/widgets/TextWidget.dart';
class CartItem extends StatefulWidget {
final Cart cart;
final Function modifyQuantity;
final int index;
CartItem({this.cart, this.modifyQuantity, this.index}) : super();
@override
_CartItemState createState() => _CartItemState();
}
class _CartItemState extends State<CartItem> {
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () => Navigator.of(context).pushNamed(Router.GROCERY_DETAIL,
arguments: ParamType(
heroId: widget.cart.grocery.hashCode,
grocery: widget.cart.grocery)),
child: Column(
children: [
Container(
color: Colors.white,
height: 110,
width: MediaQuery.of(context).size.width,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(Constant.HALF_PADDING_VIEW),
child: Hero(
tag: widget.cart.grocery.hashCode,
child: Image.asset(
'${widget.cart.grocery.image}',
width: 60,
height: 60,
),
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.fromLTRB(
Constant.HALF_PADDING_VIEW / 2,
Constant.HALF_PADDING_VIEW + 5,
Constant.HALF_PADDING_VIEW,
Constant.HALF_PADDING_VIEW),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: TextWidget(
text: widget.cart.grocery.name,
fontColor: Pallete.textColor,
fontSize: Constant.TEXT_FONT,
fontFamily: Constant.ROBOTO_REGULAR,
)),
Expanded(
child: TextWidget(
text: widget.cart.grocery.size,
fontColor: Pallete.textSubTitle,
fontSize: Constant.SUB_TEXT_FONT,
fontFamily: Constant.ROBOTO_MEDIUM,
)),
Expanded(
child: TextWidget(
text:
'${Constant.RUPEE} ${widget.cart.grocery.price}',
fontColor: Pallete.primaryColor,
fontSize: Constant.HINT_TEXT_FONT,
fontFamily: Constant.ROBOTO_MEDIUM,
)),
],
),
),
),
Padding(
padding: const EdgeInsets.fromLTRB(
0, 0, Constant.HALF_PADDING_VIEW, 0),
child: AddQuantityView(
modifyQuantity: widget.modifyQuantity,
viewSize: 30,
index: widget.index),
)
],
),
),
Divider(
thickness: 1,
height: 0,
)
],
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/cart/CartView.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/pages/cart/CartItem.dart';
import 'package:flutter_grocery/pages/modal/Cart.dart';
class CartView extends StatefulWidget {
final List<Cart> listCart;
final Function modifyQuantity;
CartView({this.listCart, this.modifyQuantity}) : super();
@override
_CartViewState createState() => _CartViewState();
}
class _CartViewState extends State<CartView> {
@override
Widget build(BuildContext context) {
return Container(
child: ListView.builder(
// padding: EdgeInsets.all(Constant.HALF_PADDING_VIEW),
shrinkWrap: true,
primary: false,
// itemExtent: 240,
itemBuilder: (BuildContext context, int index) => Container(
child: CartItem(
cart: widget.listCart[index],
modifyQuantity: widget.modifyQuantity,
index: index
),
),
itemCount: widget.listCart.length,
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/account/AccountsPage.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/pages/grocery_list/detail/GroceryProductDescription.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/util/Pallete.dart';
import 'package:flutter_grocery/util/Router.dart';
import 'package:flutter_grocery/widgets/ButtonWidget.dart';
import 'package:flutter_grocery/widgets/TextWidget.dart';
class AccountsPage extends StatefulWidget {
@override
_AccountsPageState createState() => _AccountsPageState();
}
class _AccountsPageState extends State<AccountsPage> {
@override
Widget build(BuildContext context) {
return Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
color: Pallete.appBgColor,
child: SingleChildScrollView(
padding: EdgeInsets.fromLTRB(0, 0, 0, Constant.PADDING_VIEW),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.fromLTRB(
Constant.PADDING_VIEW,
Constant.PADDING_VIEW,
Constant.PADDING_VIEW,
Constant.PADDING_VIEW / 2),
child: Row(
children: [
CircleAvatar(
radius: 50,
backgroundColor: Colors.white,
backgroundImage: NetworkImage(
'https://avatars3.githubusercontent.com/u/24696317?s=460&u=a1a5138396b9013e53f1ea0d04d19739c5f26650&v=4'),
),
Padding(
padding: const EdgeInsets.all(Constant.PADDING_VIEW),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextWidget(
text: Constant.USER_NAME,
fontColor: Pallete.textColor,
fontSize: Constant.APP_BAR_TEXT_FONT,
fontFamily: Constant.ROBOTO_MEDIUM,
),
Padding(
padding: const EdgeInsets.fromLTRB(0, 10, 0, 0),
child: TextWidget(
text: Constant.DUMMY_MOBILE_EXAMPLE,
fontColor: Pallete.textSubTitle,
fontSize: Constant.TEXT_FONT,
fontFamily: Constant.ROBOTO_MEDIUM,
),
),
],
),
)
],
),
),
Padding(
padding: const EdgeInsets.fromLTRB(
Constant.PADDING_VIEW, 0, Constant.PADDING_VIEW, 0),
child: Divider(
thickness: 1,
),
),
GroceryProductDescription(
title: "Profile Settings",
description: "Change Your Basic Profile"),
Padding(
padding: const EdgeInsets.fromLTRB(
Constant.PADDING_VIEW, 0, Constant.PADDING_VIEW, 0),
child: Divider(
thickness: 1,
),
),
GroceryProductDescription(
title: "My Address", description: "Change Address Settings"),
Padding(
padding: const EdgeInsets.fromLTRB(
Constant.PADDING_VIEW, 0, Constant.PADDING_VIEW, 0),
child: Divider(
thickness: 1,
),
),
GroceryProductDescription(
title: "Help & Support", description: "Get Support From Us"),
Padding(
padding: const EdgeInsets.fromLTRB(
Constant.PADDING_VIEW, 0, Constant.PADDING_VIEW, 0),
// child: Divider(
// thickness: 1,
// ),
),
SizedBox(
height: Constant.PADDING_VIEW,
),
ButtonWidget(
text: "Logout",
buttonColor: Pallete.primaryColor,
fontSize: Constant.HINT_TEXT_FONT,
onPress: () => Navigator.pushNamedAndRemoveUntil(context,
Router.LANDING, ModalRoute.withName(Router.LANDING)))
],
),
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/modal/ParamType.dart | import 'package:flutter_grocery/pages/modal/Grocery.dart';
import 'package:flutter_grocery/pages/modal/Orders.dart';
class ParamType {
String title = "";
Grocery grocery = Grocery();
// ignore: missing_required_param
Orders orders = Orders();
int heroId = 0;
ParamType({this.title, this.grocery, this.heroId, this.orders});
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/modal/Grocery.dart | class Grocery {
String name, details;
int price;
String size;
String image;
Grocery({this.name, this.price, this.size, this.image, this.details})
: super();
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/modal/Orders.dart | import 'package:flutter/material.dart';
class Orders {
Status status;
String date;
String transactionId;
String deliveredTo;
String totalPayment;
Orders(
{@required this.status,
@required this.date,
@required this.transactionId,
@required this.deliveredTo,
@required this.totalPayment})
: super();
}
class Status {
String name;
Color bgColor;
Color textColor;
Status({
@required this.name,
@required this.bgColor,
@required this.textColor,
}) : super();
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/modal/Cart.dart | import 'package:flutter_grocery/pages/modal/Grocery.dart';
class Cart {
Grocery grocery;
int quantity;
Cart({this.grocery, this.quantity});
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/grocery_list | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/grocery_list/detail/AddQuatityView.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/util/Pallete.dart';
import 'package:flutter_grocery/util/StyleUtil.dart';
// ignore: must_be_immutable
class AddQuantityView extends StatefulWidget {
final Function modifyQuantity;
final double viewSize;
final int index;
AddQuantityView({this.modifyQuantity, this.viewSize, this.index}) : super();
@override
_AddQuantityViewState createState() => _AddQuantityViewState();
}
class _AddQuantityViewState extends State<AddQuantityView> {
int numOfItems = 1;
void changeQuantity(type) {
setState(() {
numOfItems =
(type == 1) ? numOfItems + 1 : numOfItems == 1 ? 1 : numOfItems - 1;
widget.modifyQuantity(type, numOfItems, widget.index);
});
}
@override
Widget build(BuildContext context) {
return Card(
color: Pallete.countViewColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(Constant.BORDER_RADIUS)),
elevation: Constant.CARD_ELEVATION - 0.5,
child: SizedBox(
height: widget.viewSize,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Container(
width: widget.viewSize,
height: widget.viewSize,
child: Center(
child: IconButton(
color: Pallete.textSubTitle,
iconSize: widget.viewSize / 2,
icon: Icon(Icons.remove),
onPressed: () => changeQuantity(0),
)),
),
Container(
color: Pallete.appBgColor,
width: widget.viewSize,
height: widget.viewSize,
child: Center(
child: Text(
'$numOfItems',
style: StyleUtil.textAddQuantityStyle,
)),
),
Container(
width: widget.viewSize,
height: widget.viewSize,
child: Center(
child: IconButton(
color: Pallete.textSubTitle,
icon: Icon(Icons.add),
iconSize: widget.viewSize / 2,
onPressed: () => changeQuantity(1),
)),
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/grocery_list | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/grocery_list/detail/GroceryNamePriceView.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/pages/grocery_list/detail/AddQuatityView.dart';
import 'package:flutter_grocery/pages/modal/Grocery.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/util/Pallete.dart';
import 'package:flutter_grocery/widgets/TextWidget.dart';
class GroceryNamePriceView extends StatefulWidget {
final Grocery grocery;
GroceryNamePriceView({this.grocery}) : super();
@override
_GroceryNamePriceViewState createState() => _GroceryNamePriceViewState();
}
class _GroceryNamePriceViewState extends State<GroceryNamePriceView> {
int numOfItems = 1;
void modifyQuantity(type, numItems, index) {
setState(() {
switch (type) {
case 1:
this.numOfItems = numItems++;
break;
case 0:
numOfItems = numItems--;
break;
default:
}
});
}
@override
Widget build(BuildContext context) {
return Container(
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.fromLTRB(
Constant.PADDING_VIEW,
Constant.HALF_PADDING_VIEW,
Constant.PADDING_VIEW,
Constant.HALF_PADDING_VIEW),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.end,
children: [
Row(
children: [
Expanded(
child: TextWidget(
text: widget.grocery.name,
fontColor: Pallete.textColor,
fontSize: Constant.APP_BAR_TEXT_FONT,
fontFamily: Constant.ROBOTO_MEDIUM,
maxLines: 1,
),
),
SizedBox(
height: Constant.HALF_PADDING_VIEW,
),
],
),
SizedBox(
height: Constant.HALF_PADDING_VIEW / 2,
),
Row(
children: [
Expanded(
child: TextWidget(
text: "₹ ${widget.grocery.price * numOfItems}",
fontColor: Pallete.primaryColor,
fontSize: Constant.PRICE_TEXT_FONT,
fontFamily: Constant.ROBOTO_MEDIUM,
),
),
AddQuantityView(
modifyQuantity: modifyQuantity,
viewSize: 35,
)
],
),
SizedBox(
height: Constant.HALF_PADDING_VIEW,
),
],
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/grocery_list | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/grocery_list/detail/GroceryProductDescription.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/util/Pallete.dart';
import 'package:flutter_grocery/widgets/TextWidget.dart';
class GroceryProductDescription extends StatelessWidget {
final String title;
final String description;
GroceryProductDescription({this.title, this.description}) : super();
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.all(Constant.PADDING_VIEW),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextWidget(
text: title,
fontSize: Constant.HINT_TEXT_FONT,
fontFamily: Constant.ROBOTO_MEDIUM,
fontColor: Pallete.textColor,
),
SizedBox(
height: Constant.HALF_PADDING_VIEW,
),
TextWidget(
text: description,
fontSize: Constant.TEXT_FONT,
fontFamily: Constant.ROBOTO_REGULAR,
maxLines: 200,
)
],
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/grocery_list | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/grocery_list/detail/GroceryDetailPage.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/pages/grocery_list/detail/GroceryNamePriceView.dart';
import 'package:flutter_grocery/pages/grocery_list/detail/GroceryProductDescription.dart';
import 'package:flutter_grocery/pages/grocery_list/list/GroceryViewHorizontalList.dart';
import 'package:flutter_grocery/pages/modal/ParamType.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/util/Helper.dart';
import 'package:flutter_grocery/util/Pallete.dart';
import 'package:flutter_grocery/widgets/MainAppBar.dart';
import 'package:flutter_grocery/widgets/NameBottonButton.dart';
import 'package:flutter_grocery/widgets/TextWidget.dart';
class GroceryDetailPage extends StatefulWidget {
@override
_GroceryDetailPageState createState() => _GroceryDetailPageState();
}
class _GroceryDetailPageState extends State<GroceryDetailPage> {
@override
Widget build(BuildContext context) {
ParamType paramType = ModalRoute.of(context).settings.arguments;
return Scaffold(
appBar: MainAppBar(
context: context,
text: "",
isCenterTitle: false,
isHideSearch: true,
),
body: Container(
color: Colors.white,
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Stack(
alignment: Alignment.topRight,
children: [
Hero(
tag: paramType.heroId,
child: Image.asset(
paramType.grocery.image,
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height / 3,
fit: BoxFit.contain,
)),
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(Constant.BORDER_RADIUS))),
elevation: Constant.CARD_ELEVATION,
margin: EdgeInsets.all(Constant.HALF_PADDING_VIEW),
color: Pallete.countViewColor,
child: Container(
padding: EdgeInsets.fromLTRB(
Constant.HALF_PADDING_VIEW,
Constant.HALF_PADDING_VIEW / 2,
Constant.HALF_PADDING_VIEW,
Constant.HALF_PADDING_VIEW / 2),
child: TextWidget(
text: paramType.grocery.size,
fontColor: Pallete.textSubTitle,
fontFamily: Constant.ROBOTO_MEDIUM,
fontSize: Constant.SUB_TEXT_FONT,
)),
),
],
),
Divider(
height: 20,
thickness: 1,
),
GroceryNamePriceView(
grocery: paramType.grocery,
),
Padding(
padding: const EdgeInsets.fromLTRB(20, 0, 20, 0),
child: Divider(
height: 2,
thickness: 1,
),
),
GroceryProductDescription(
title: Constant.PRODUCT_DETAIL,
description: paramType.grocery.details,
),
Container(
color: Pallete.appBgColor,
child: GroceryViewHorizontalList(
listGrocery: Helper.getVegetableList(),
isFromHome: true,
),
)
],
),
),
),
bottomNavigationBar: NameBottonButton(
name: "Add to Cart",
onTabPress: null,
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/grocery_list | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/grocery_list/list/GroceryViewHorizontalList.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/pages/grocery_list/list/GroceryItem.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/pages/modal/Grocery.dart';
import 'package:flutter_grocery/util/Pallete.dart';
import 'package:flutter_grocery/widgets/TextWidget.dart';
// ignore: must_be_immutable
class GroceryViewHorizontalList extends StatefulWidget {
List<Grocery> listGrocery = [];
bool isFromHome = false;
GroceryViewHorizontalList({this.listGrocery, this.isFromHome}) : super();
@override
_GroceryViewHorizontalListState createState() =>
_GroceryViewHorizontalListState();
}
class _GroceryViewHorizontalListState extends State<GroceryViewHorizontalList> {
@override
Widget build(BuildContext context) {
return Container(
height: 380,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.fromLTRB(
Constant.PADDING_VIEW, Constant.PADDING_VIEW, 0, 0),
child: TextWidget(
text: "You might also need",
fontColor: Pallete.textColor,
fontSize: Constant.HINT_TEXT_FONT,
fontFamily: Constant.ROBOTO_MEDIUM,
),
),
Expanded(
child: ListView.builder(
// physics: widget.isFromHome == null
// ? AlwaysScrollableScrollPhysics()
// : widget.isFromHome
// ? NeverScrollableScrollPhysics()
// : AlwaysScrollableScrollPhysics(),
padding: EdgeInsets.all(Constant.HALF_PADDING_VIEW),
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemExtent: 220,
itemBuilder: (BuildContext context, int index) => Container(
child: Padding(
padding: const EdgeInsets.all(5.0),
child: GroceryItem(grocery: widget.listGrocery[index]),
),
),
itemCount: widget.listGrocery.length,
),
),
],
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/grocery_list | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/grocery_list/list/GroceryViewList.dart | import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_grocery/pages/grocery_list/list/GroceryItem.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/pages/modal/Grocery.dart';
// ignore: must_be_immutable
class GroceryViewList extends StatefulWidget {
List<Grocery> listGrocery = [];
bool isFromHome = false;
GroceryViewList({this.listGrocery, this.isFromHome}) : super();
@override
_GroceryViewListState createState() => _GroceryViewListState();
}
class _GroceryViewListState extends State<GroceryViewList> {
@override
Widget build(BuildContext context) {
return Container(
child: GridView.builder(
physics: widget.isFromHome == null
? AlwaysScrollableScrollPhysics()
: widget.isFromHome
? NeverScrollableScrollPhysics()
: AlwaysScrollableScrollPhysics(),
padding: EdgeInsets.all(Constant.HALF_PADDING_VIEW),
shrinkWrap: true, // Important else view disappears
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: Constant.HALF_PADDING_VIEW / 2,
mainAxisSpacing: Constant.HALF_PADDING_VIEW / 2,
childAspectRatio: MediaQuery.of(context).size.width /
(MediaQuery.of(context).size.height /
(Platform.isIOS ? 1.40 : 1.05))),
itemBuilder: (BuildContext context, int index) => Container(
child: GroceryItem(grocery: widget.listGrocery[index]),
),
itemCount: widget.listGrocery.length,
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/grocery_list | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/grocery_list/list/FilterSortView.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/util/Pallete.dart';
import 'package:flutter_grocery/widgets/TextWidget.dart';
class FilterSortView extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
child: Row(
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.all(Constant.HALF_PADDING_VIEW),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.filter_list),
SizedBox(width: Constant.HALF_PADDING_VIEW),
TextWidget(
text: Constant.FILTER,
fontColor: Pallete.textColor,
fontSize: Constant.TEXT_FONT)
],
),
)),
Container(
height: 50,
width: 1,
child: VerticalDivider(color: Colors.grey[400])),
Expanded(
child: Padding(
padding: const EdgeInsets.all(Constant.HALF_PADDING_VIEW),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.sort),
SizedBox(width: Constant.HALF_PADDING_VIEW),
TextWidget(
text: Constant.SORT,
fontColor: Pallete.textColor,
fontSize: Constant.TEXT_FONT)
],
),
))
],
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/grocery_list | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/grocery_list/list/GroceryListPage.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/pages/grocery_list/list/FilterSortView.dart';
import 'package:flutter_grocery/pages/grocery_list/list/GroceryViewList.dart';
import 'package:flutter_grocery/pages/modal/ParamType.dart';
import 'package:flutter_grocery/util/Pallete.dart';
import 'package:flutter_grocery/widgets/MainAppBar.dart';
import 'package:flutter_grocery/util/Helper.dart';
class GroceryListPage extends StatefulWidget {
@override
_GroceryListPageState createState() => _GroceryListPageState();
}
class _GroceryListPageState extends State<GroceryListPage> {
@override
Widget build(BuildContext context) {
final ParamType data = ModalRoute.of(context).settings.arguments;
return Scaffold(
appBar: MainAppBar(
text: data.title,
isCenterTitle: false,
context: context,
),
body: SafeArea(
child: Container(
color: Pallete.appBgColor,
child: Column(
children: [
FilterSortView(),
Expanded(
child:
GroceryViewList(listGrocery: Helper.getVegetableList()))
],
)),
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/grocery_list | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/grocery_list/list/GroceryItem.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/pages/modal/ParamType.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/pages/modal/Grocery.dart';
import 'package:flutter_grocery/util/Pallete.dart';
import 'package:flutter_grocery/util/Router.dart';
import 'package:flutter_grocery/widgets/TextWidget.dart';
class GroceryItem extends StatefulWidget {
final Grocery grocery;
GroceryItem({this.grocery});
@override
_GroceryItemState createState() => _GroceryItemState();
}
class _GroceryItemState extends State<GroceryItem> {
@override
Widget build(BuildContext context) {
return Card(
elevation: Constant.CARD_ELEVATION,
child: GestureDetector(
onTap: () => Navigator.of(context).pushNamed(Router.GROCERY_DETAIL,
arguments: ParamType(
grocery: widget.grocery, heroId: widget.grocery.hashCode)),
child: Container(
padding: EdgeInsets.all(Constant.HALF_PADDING_VIEW),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
flex: 10,
child: Center(
child: Hero(
tag: widget.grocery.hashCode,
child: Image.asset(
widget.grocery.image,
width: 200,
height: 180,
fit: BoxFit.contain,
),
),
),
),
Expanded(
flex: 1,
child: TextWidget(
text: "${Constant.RUPEE} ${widget.grocery.price}",
fontColor: Pallete.primaryColor,
fontSize: Constant.APP_BAR_TEXT_FONT,
fontFamily: Constant.ROBOTO_BOLD,
),
),
SizedBox(
height: 5,
),
Expanded(
flex: 1,
child: TextWidget(
text: widget.grocery.name,
fontColor: Pallete.textColor,
fontSize: Constant.TEXT_FONT,
fontFamily: Constant.ROBOTO_MEDIUM,
maxLines: 1,
),
),
SizedBox(
height: 5,
),
Expanded(
flex: 1,
child: TextWidget(
text: widget.grocery.size,
fontColor: Pallete.textSubTitle,
fontSize: Constant.SUB_TEXT_FONT,
fontFamily: Constant.ROBOTO_REGULAR,
),
)
],
),
),
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/orders/OrderCurrentStatus.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/pages/modal/Orders.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/util/Pallete.dart';
import 'package:flutter_grocery/widgets/TextWidget.dart';
class OrderCurrentStatus extends StatefulWidget {
final Orders orders;
OrderCurrentStatus({this.orders}) : super();
@override
_OrderCurrentStatusState createState() => _OrderCurrentStatusState();
}
class _OrderCurrentStatusState extends State<OrderCurrentStatus> {
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.all(Constant.PADDING_VIEW),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
TextWidget(
text: Constant.ORDER_STATUS,
fontSize: Constant.HINT_TEXT_FONT,
fontColor: Pallete.textColor,
fontFamily: Constant.ROBOTO_MEDIUM,
),
TextWidget(
text: widget.orders.date,
fontSize: Constant.TEXT_FONT,
fontColor: Pallete.textColor,
),
],
),
Container(
padding: EdgeInsets.fromLTRB(0, Constant.PADDING_VIEW, 0, 0),
child: Row(
children: [
Icon(
Icons.stop,
color: Pallete.primaryColor,
),
Padding(
padding: const EdgeInsets.fromLTRB(
Constant.HALF_PADDING_VIEW, 0, 0, 0),
child: TextWidget(
text: "Preparing order",
fontSize: Constant.TEXT_FONT,
fontColor: Pallete.textColor,
),
)
],
),
),
Container(
height: Constant.ORDER_STATUS_HEIGHT,
width: 25,
child: VerticalDivider(color: Colors.grey[400])),
Container(
// padding: EdgeInsets.fromLTRB(0, Constant.PADDING_VIEW, 0, 0),
child: Row(
children: [
Icon(
Icons.stop,
color: Pallete.primaryColor,
),
Padding(
padding: const EdgeInsets.fromLTRB(
Constant.HALF_PADDING_VIEW, 0, 0, 0),
child: TextWidget(
text: Constant.ORDER_DISPATCHED,
fontSize: Constant.TEXT_FONT,
fontColor: Pallete.textColor,
),
)
],
),
),
Container(
height: Constant.ORDER_STATUS_HEIGHT,
width: 25,
child: VerticalDivider(color: Colors.grey[400])),
Container(
// padding: EdgeInsets.fromLTRB(0, Constant.PADDING_VIEW, 0, 0),
child: Row(
children: [
Icon(
Icons.stop,
color: Pallete.primaryColor,
),
Padding(
padding: const EdgeInsets.fromLTRB(
Constant.HALF_PADDING_VIEW, 0, 0, 0),
child: TextWidget(
text: Constant.DELIVER_ORDER,
fontSize: Constant.TEXT_FONT,
fontColor: Pallete.textColor,
),
)
],
),
),
Container(
height: Constant.ORDER_STATUS_HEIGHT,
width: 25,
child: VerticalDivider(color: Colors.grey[400])),
Container(
// padding: EdgeInsets.fromLTRB(0, Constant.PADDING_VIEW, 0, 0),
child: Row(
children: [
Icon(
Icons.check_circle,
color: Pallete.primaryColor,
),
Padding(
padding: const EdgeInsets.fromLTRB(
Constant.HALF_PADDING_VIEW, 0, 0, 0),
child: TextWidget(
text: Constant.READY_COLLECT,
fontSize: Constant.TEXT_FONT,
fontColor: Pallete.textColor,
),
)
],
),
)
],
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/orders/OrdersPage.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/pages/modal/Orders.dart';
import 'package:flutter_grocery/pages/orders/OrdersItem.dart';
import 'package:flutter_grocery/util/Helper.dart';
import 'package:flutter_grocery/util/Pallete.dart';
class OrdersPage extends StatefulWidget {
final List<Orders> listOrders = Helper.getOrderList();
@override
_OrdersPageState createState() => _OrdersPageState();
}
class _OrdersPageState extends State<OrdersPage> {
@override
Widget build(BuildContext context) {
return Container(
color: Pallete.appBgColor,
child: ListView.builder(
itemCount: widget.listOrders.length,
itemBuilder: (BuildContext context, int index) {
return OrdersItem(orders: widget.listOrders[index]);
}),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/orders/OrdersItem.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/pages/modal/Orders.dart';
import 'package:flutter_grocery/pages/modal/ParamType.dart';
import 'package:flutter_grocery/pages/orders/OrderStatusView.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/util/Pallete.dart';
import 'package:flutter_grocery/util/Router.dart';
import 'package:flutter_grocery/widgets/TextWidget.dart';
class OrdersItem extends StatelessWidget {
final Orders orders;
OrdersItem({this.orders});
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () => Navigator.of(context).pushNamed(Router.ORDER_DETAILS,
arguments:
ParamType(title: orders.transactionId, orders: this.orders)),
child: Container(
margin: EdgeInsets.fromLTRB(
Constant.HALF_PADDING_VIEW,
Constant.HALF_PADDING_VIEW / 3,
Constant.HALF_PADDING_VIEW,
Constant.HALF_PADDING_VIEW / 3),
child: Card(
elevation: Constant.CARD_ELEVATION,
child: Container(
child: Column(
children: [
Padding(
padding: const EdgeInsets.fromLTRB(Constant.PADDING_VIEW,
Constant.PADDING_VIEW, Constant.PADDING_VIEW, 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
OrderStatusView(
status: orders.status.name,
bgColor: orders.status.bgColor,
textColor: orders.status.textColor,
),
TextWidget(
text: orders.date,
fontColor: Pallete.textSubTitle,
)
],
),
),
Padding(
padding: const EdgeInsets.fromLTRB(
Constant.PADDING_VIEW,
Constant.HALF_PADDING_VIEW,
Constant.PADDING_VIEW,
Constant.PADDING_VIEW),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextWidget(
text: Constant.TRANSACTION_ID,
fontColor: Pallete.textSubTitle,
fontSize: Constant.SMALL_TEXT_FONT,
fontFamily: Constant.ROBOTO_MEDIUM,
),
SizedBox(
height: Constant.HALF_PADDING_VIEW / 2,
),
TextWidget(
text: orders.transactionId,
fontColor: Pallete.textColor,
fontSize: Constant.SUB_TEXT_FONT,
)
],
),
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextWidget(
text: Constant.DELIVERED_TO,
fontColor: Pallete.textSubTitle,
fontSize: Constant.SMALL_TEXT_FONT,
fontFamily: Constant.ROBOTO_MEDIUM,
),
SizedBox(
height: Constant.HALF_PADDING_VIEW / 2,
),
TextWidget(
text: orders.deliveredTo,
fontColor: Pallete.textColor,
fontSize: Constant.SUB_TEXT_FONT,
)
],
),
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextWidget(
text: Constant.TOTAL_PAYMENT,
fontColor: Pallete.textSubTitle,
fontSize: Constant.SMALL_TEXT_FONT,
fontFamily: Constant.ROBOTO_MEDIUM,
),
SizedBox(
height: Constant.HALF_PADDING_VIEW / 2,
),
TextWidget(
text: '${Constant.RUPEE} ${orders.totalPayment}',
fontColor: Pallete.textColor,
fontSize: Constant.SUB_TEXT_FONT,
)
],
),
),
],
),
)
],
),
),
),
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/orders/OrderDetailsPage.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/pages/grocery_list/detail/GroceryProductDescription.dart';
import 'package:flutter_grocery/pages/modal/Orders.dart';
import 'package:flutter_grocery/pages/modal/ParamType.dart';
import 'package:flutter_grocery/pages/orders/OrderCurrentStatus.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/widgets/MainAppBar.dart';
class OrderDetailsPage extends StatefulWidget {
@override
_OrderDetailsPageState createState() => _OrderDetailsPageState();
}
class _OrderDetailsPageState extends State<OrderDetailsPage> {
@override
Widget build(BuildContext context) {
ParamType paramType = ModalRoute.of(context).settings.arguments;
Orders orders = paramType.orders;
return Scaffold(
appBar: MainAppBar(
context: context,
text: paramType.title,
isHideSearch: true,
),
body: SingleChildScrollView(
child: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GroceryProductDescription(
title: Constant.BOOKING_DATE,
description: '${orders.date}',
),
Divider(
thickness: 1,
height: 1,
),
OrderCurrentStatus(orders: orders),
Divider(
thickness: 1,
height: 1,
),
GroceryProductDescription(
title: Constant.DESTINATION,
description: Constant.PRODUCT_ADDRESS,
),
Divider(
thickness: 1,
height: 1,
),
GroceryProductDescription(
title: Constant.COURIER,
description: '${Constant.APP_NAME} ${Constant.COURIER}',
),
Divider(
thickness: 1,
height: 1,
),
GroceryProductDescription(
title: Constant.TOTAL_PAYMENT,
description: '${Constant.RUPEE} ${orders.totalPayment}',
),
],
),
),
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/orders/OrderStatusView.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/widgets/TextWidget.dart';
class OrderStatusView extends StatelessWidget {
final String status;
final Color bgColor, textColor;
OrderStatusView({this.status, this.bgColor, this.textColor}) : super();
@override
Widget build(BuildContext context) {
return Card(
elevation: 0,
color: bgColor,
child: Padding(
padding: const EdgeInsets.fromLTRB(
Constant.HALF_PADDING_VIEW,
Constant.HALF_PADDING_VIEW / 2,
Constant.HALF_PADDING_VIEW,
Constant.HALF_PADDING_VIEW / 2),
child: TextWidget(
text: status,
fontSize: Constant.SMALL_TEXT_FONT,
fontColor: textColor,
),
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/auth/VerifyOTPPage.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/util/Pallete.dart';
import 'package:flutter_grocery/util/Router.dart';
import 'package:flutter_grocery/widgets/ButtonWidget.dart';
import 'package:flutter_grocery/widgets/TextAppBar.dart';
import 'package:flutter_grocery/widgets/TextWidget.dart';
class VerifyOTPPage extends StatefulWidget {
@override
_VerifyOtpPageState createState() => _VerifyOtpPageState();
}
class _VerifyOtpPageState extends State<VerifyOTPPage> {
final _formKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Pallete.primaryColor,
centerTitle: false,
title: TextAppBar(text: Constant.VERIFY_OTP),
),
body: SafeArea(
child: Stack(alignment: Alignment.bottomCenter, children: [
Padding(
padding: const EdgeInsets.all(Constant.PADDING_VIEW),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 40,
),
TextWidget(
text: Constant.VERIFY_NUMBER,
fontColor: Pallete.textColor,
fontSize: Constant.MEDIUM_TEXT_FONT,
fontFamily: Constant.ROBOTO_BOLD,
),
SizedBox(
height: 30,
),
TextWidget(
text: Constant.HINT_ENTER_CODE,
fontColor: Pallete.textSubTitle,
fontSize: Constant.TEXT_FONT,
),
SizedBox(
height: 10,
),
TextWidget(
text: Constant.DUMMY_MOBILE_EXAMPLE,
fontColor: Pallete.textColor,
fontSize: Constant.TEXT_FONT,
fontFamily: Constant.ROBOTO_MEDIUM,
),
Padding(
padding: const EdgeInsets.fromLTRB(0, 30, 0, 15),
child: Form(
key: _formKey,
child: TextFormField(
maxLength: 4,
style: TextStyle(
fontSize: Constant.TEXT_FONT,
color: Pallete.textColor),
decoration: InputDecoration(
suffixIcon: Icon(
Icons.phone_iphone,
color: Pallete.primaryColor,
),
hintText: Constant.HINT_OTP_EXAMPLE,
hintStyle: TextStyle(
fontSize: Constant.TEXT_FONT,
fontFamily: Constant.ROBOTO_REGULAR),
alignLabelWithHint: true,
floatingLabelBehavior: FloatingLabelBehavior.always,
labelText: Constant.HINT_OTP_NUMBER,
labelStyle: TextStyle(
color: Pallete.primaryColor,
fontSize: Constant.HINT_TEXT_FONT)),
validator: (value) {
if (value.isEmpty) {
return Constant.INVALID_OTP_CODE;
}
return null;
},
cursorColor: Pallete.primaryColor,
keyboardType: TextInputType.phone,
),
),
),
Padding(
padding: const EdgeInsets.all(10.0),
child: Center(
child: TextWidget(
text: Constant.RESEND_CODE,
fontColor: Pallete.primaryColor,
fontSize: Constant.TEXT_FONT,
),
),
),
],
),
),
Padding(
padding: const EdgeInsets.fromLTRB(0, 0, 0, Constant.PADDING_VIEW),
child: ButtonWidget(
text: Constant.CONTINUE,
fontSize: 20,
buttonColor: Pallete.primaryColor,
onPress: () {
if (_formKey.currentState.validate()) {
// Navigator.of(context).pushNamed(Router.TABS);
Navigator.pushNamedAndRemoveUntil(
context, Router.TABS, ModalRoute.withName(Router.TABS));
}
},
),
),
]),
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/auth/LandingPageContent.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/util/Pallete.dart';
import 'package:flutter_grocery/widgets/TextWidget.dart';
class LandingPageContent extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.fromLTRB(10, 0, 10, 0),
child: Image.asset(
'${Constant.PATH_IMAGE}/app_icon.jpg',
width: 60,
height: 60,
),
),
Padding(
padding: const EdgeInsets.fromLTRB(20, 10, 10, 0),
child: TextWidget(
text: Constant.WELCOME,
fontSize: Constant.BIG_TEXT_FONT,
fontColor: Pallete.textColor,
fontFamily: Constant.ROBOTO_BOLD,
),
),
Padding(
padding: const EdgeInsets.fromLTRB(20, 0, 10, 0),
child: TextWidget(
text: Constant.APP_NAME,
fontSize: Constant.BIG_TEXT_FONT,
fontColor: Pallete.textColor,
fontFamily: Constant.ROBOTO_BOLD,
),
),
Padding(
padding: const EdgeInsets.fromLTRB(20, 5, 20, 0),
child: TextWidget(
text: Constant.WELCOME_TEXT,
fontSize: Constant.TEXT_FONT,
fontColor: Pallete.textSubTitle,
maxLines: 20,
),
),
],
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/auth/LoginPage.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/pages/modal/ParamType.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/util/Pallete.dart';
import 'package:flutter_grocery/util/Router.dart';
import 'package:flutter_grocery/widgets/ButtonWidget.dart';
import 'package:flutter_grocery/widgets/TextAppBar.dart';
import 'package:flutter_grocery/widgets/TextWidget.dart';
class LoginPage extends StatefulWidget {
@override
_LoginPageState createState() => _LoginPageState();
}
class _LoginPageState extends State<LoginPage> {
final _formKey = GlobalKey<FormState>();
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
ParamType params = ModalRoute.of(context).settings.arguments;
return Scaffold(
appBar: AppBar(
backgroundColor: Pallete.primaryColor,
title: TextAppBar(text: params.title),
centerTitle: false,
),
body: SafeArea(
child: Container(
child: Stack(
alignment: Alignment.bottomCenter,
children: [
Padding(
padding: const EdgeInsets.all(Constant.PADDING_VIEW),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 40,
),
TextWidget(
text: params.title == Constant.LOGIN
? Constant.WELCOME_BACK
: Constant.GET_STARTED,
fontColor: Pallete.textColor,
fontSize: Constant.MEDIUM_TEXT_FONT,
fontFamily: Constant.ROBOTO_BOLD,
),
SizedBox(
height: 10,
),
TextWidget(
text: params.title == Constant.LOGIN
? Constant.ALREADY_HAVE_ACCOUNT
: Constant.TOP_PICKS,
fontColor: Pallete.textSubTitle,
fontSize: Constant.TEXT_FONT,
maxLines: 200,
),
Padding(
padding: const EdgeInsets.fromLTRB(0, 50, 0, 15),
child: Form(
key: _formKey,
child: TextFormField(
maxLength: 10,
style:
TextStyle(fontSize: 18, color: Pallete.textColor),
decoration: InputDecoration(
hintText: Constant.HINT_MOBILE_EXAMPLE,
hintStyle: TextStyle(
fontSize: Constant.TEXT_FONT,
fontFamily: Constant.ROBOTO_REGULAR),
alignLabelWithHint: true,
// floatingLabelBehavior:
// FloatingLabelBehavior.always,
labelText: Constant.HINT_MOBILE_NUMBER,
labelStyle: TextStyle(
color: Pallete.primaryColor,
fontSize: Constant.HINT_TEXT_FONT)),
validator: (value) {
if (value.isEmpty) {
return Constant.INVALID_MOBILE_NUMBER;
}
return null;
},
cursorColor: Pallete.primaryColor,
keyboardType: TextInputType.phone,
),
),
),
TextWidget(
text: Constant.STANDARD_RATES_APPLY,
fontColor: Pallete.textSubTitle,
fontSize: 14,
),
],
),
),
Padding(
padding: const EdgeInsets.fromLTRB(0, 0, 0, 20),
child: ButtonWidget(
text: Constant.CONTINUE,
fontSize: 20,
buttonColor: Pallete.primaryColor,
onPress: () {
if (_formKey.currentState.validate()) {
Navigator.of(context).pushNamed(Router.OTP);
}
},
),
),
],
),
),
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/auth/LandingButton.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/pages/modal/ParamType.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/util/Pallete.dart';
import 'package:flutter_grocery/util/Router.dart';
import 'package:flutter_grocery/widgets/ButtonWidget.dart';
class LandingButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Column(
children: [
ButtonWidget(
text: Constant.LOGIN,
fontSize: Constant.BUTTON_FONT,
fontColor: Colors.white,
buttonColor: Pallete.primaryColor,
isBorder: false,
onPress: () {
Navigator.of(context).pushNamed(Router.LOGIN,
arguments: ParamType(title: Constant.LOGIN));
},
),
SizedBox(
height: 10,
),
ButtonWidget(
text: Constant.CREATE_ACCOUNT,
fontSize: Constant.BUTTON_FONT,
fontColor: Pallete.textColor,
buttonColor: Colors.white,
isBorder: true,
onPress: () {
Navigator.of(context).pushNamed(Router.LOGIN,
arguments: ParamType(title: Constant.CREATE_ACCOUNT));
},
)
],
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/auth/LandingPage.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/pages/auth/LandingButton.dart';
import 'package:flutter_grocery/pages/auth/LandingPageContent.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/util/Pallete.dart';
import 'package:flutter_grocery/widgets/TextWidget.dart';
class LandingPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
child: SafeArea(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
new Stack(
children: <Widget>[
Image.asset(
'${Constant.PATH_IMAGE}/app_icon.jpg',
width: 420,
height: MediaQuery.of(context).size.height / 2.9,
color: Colors.transparent,
),
Positioned(
right: -(MediaQuery.of(context).size.width / 2),
child: Image.asset(
'${Constant.PATH_IMAGE}/landing_image.png',
width: MediaQuery.of(context).size.width + 150,
height: MediaQuery.of(context).size.height / 2.5,
),
),
],
),
LandingPageContent(),
LandingButton(),
Padding(
padding: const EdgeInsets.fromLTRB(
0, 0, 0, Constant.HALF_PADDING_VIEW),
child: TextWidget(
text: Constant.TnC,
fontColor: Pallete.textSubTitle,
fontSize: Constant.SMALL_TEXT_FONT,
),
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/home/GroceryTypesView.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/pages/home/GroceryTypeItem.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/util/pallete.dart';
import 'package:flutter_grocery/widgets/TextWidget.dart';
class GroceryTypesView extends StatefulWidget {
@override
_GroceryTypesViewState createState() => _GroceryTypesViewState();
}
class _GroceryTypesViewState extends State<GroceryTypesView> {
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.all(Constant.PADDING_VIEW),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: Constant.HALF_PADDING_VIEW,
),
TextWidget(
text: Constant.LOOKING_FOR,
fontSize: Constant.HINT_TEXT_FONT,
fontColor: Pallete.textColor,
fontFamily: Constant.ROBOTO_BOLD,
),
SizedBox(height: Constant.HALF_PADDING_VIEW),
Row(
children: [
GroceryTypeItem(
image: "${Constant.PATH_IMAGE}/vegetables.png",
text: Constant.VEGATABLES),
SizedBox(width: Constant.HALF_PADDING_VIEW),
GroceryTypeItem(
image: "${Constant.PATH_IMAGE}/fruits.png",
text: Constant.FRUITS),
SizedBox(width: Constant.HALF_PADDING_VIEW),
GroceryTypeItem(
image: "${Constant.PATH_IMAGE}/milkeggs.png",
text: Constant.MILK_EGG),
SizedBox(width: Constant.HALF_PADDING_VIEW),
GroceryTypeItem(
image: "${Constant.PATH_IMAGE}/seafood.png",
text: Constant.SEAFOOD),
],
),
SizedBox(height: Constant.HALF_PADDING_VIEW),
Row(
children: [
GroceryTypeItem(
image: "${Constant.PATH_IMAGE}/bread.png",
text: Constant.BREAD),
SizedBox(width: Constant.HALF_PADDING_VIEW),
GroceryTypeItem(
image: "${Constant.PATH_IMAGE}/meat.png",
text: Constant.MEATS),
SizedBox(width: Constant.HALF_PADDING_VIEW),
GroceryTypeItem(
image: "${Constant.PATH_IMAGE}/frozen.png",
text: Constant.FROZEN),
SizedBox(width: Constant.HALF_PADDING_VIEW),
GroceryTypeItem(
image: "${Constant.PATH_IMAGE}/organic.png",
text: Constant.ORGANIC),
],
)
],
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/home/HomePromoView.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/util/Pallete.dart';
import 'package:flutter_grocery/widgets/TextWidget.dart';
class HomePromoView extends StatelessWidget {
final List images = [
// 'promo1.png',
// 'promo2.png',
'promo3.png',
'promo4.jpg',
// 'promo5.jpg',
'promo6.jpg',
'promo7.jpg'
];
final List colorList = [
// Pallete.primaryColor,
// Colors.teal,
Colors.blue,
Colors.teal,
// Colors.red,
Colors.teal,
Colors.red,
];
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: Constant.HALF_PADDING_VIEW,
),
Padding(
padding: const EdgeInsets.fromLTRB(
Constant.PADDING_VIEW, Constant.HALF_PADDING_VIEW - 5, 0, 0),
child: TextWidget(
text: "Offers for you",
fontSize: Constant.HINT_TEXT_FONT,
fontColor: Pallete.textColor,
fontFamily: Constant.ROBOTO_BOLD,
),
),
SizedBox(
height: Constant.HALF_PADDING_VIEW,
),
Container(
// color: Pallete.primaryColor,
// padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 0.0),
height: MediaQuery.of(context).size.height * 0.25,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: 4,
itemBuilder: (context, index) {
return Container(
width: MediaQuery.of(context).size.width * 0.90,
padding: EdgeInsets.fromLTRB(15, 0, 5, 0),
child: Card(
color: colorList[index],
child: Container(
child: FittedBox(
fit: index >= 1 ? BoxFit.fill : BoxFit.contain,
child: Image.asset(
'${Constant.PATH_IMAGE}/${images[index]}',
fit: BoxFit.cover,
),
),
),
));
}),
),
],
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/home/GroceryTypeItem.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/pages/modal/ParamType.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/util/Pallete.dart';
import 'package:flutter_grocery/util/Router.dart';
import 'package:flutter_grocery/widgets/TextWidget.dart';
class GroceryTypeItem extends StatefulWidget {
final String image;
final String text;
GroceryTypeItem({this.image, this.text}) : super();
@override
_GroceryTypeItemState createState() =>
_GroceryTypeItemState(image: image, text: text);
}
class _GroceryTypeItemState extends State<GroceryTypeItem> {
final String image;
final String text;
_GroceryTypeItemState({this.image, this.text}) : super();
@override
Widget build(BuildContext context) {
return Container(
child: Expanded(
child: Column(
children: [
GestureDetector(
onTap: () => Navigator.of(context).pushNamed(Router.GROCERY_LIST,
arguments: ParamType(title: text)),
child: Card(
elevation: 0,
child: Padding(
padding: const EdgeInsets.all(Constant.PADDING_VIEW - 5),
child: Image.asset(image),
),
),
),
SizedBox(
height: 5,
),
TextWidget(
text: text,
fontColor: Pallete.textSubTitle,
fontSize: 16,
)
],
),
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/home/HomePage.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/pages/grocery_list/list/GroceryViewList.dart';
import 'package:flutter_grocery/pages/home/GroceryTypesView.dart';
import 'package:flutter_grocery/pages/home/HomePromoView.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/util/Helper.dart';
import 'package:flutter_grocery/util/Pallete.dart';
import 'package:flutter_grocery/widgets/TextWidget.dart';
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
return SafeArea(
child: SingleChildScrollView(
child: Container(
color: Pallete.appBgColor,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GroceryTypesView(),
HomePromoView(),
Padding(
padding: const EdgeInsets.fromLTRB(Constant.PADDING_VIEW,
Constant.PADDING_VIEW * 2, Constant.PADDING_VIEW, 0),
child: TextWidget(
text: "Recommended for you",
fontSize: Constant.HINT_TEXT_FONT,
fontColor: Pallete.textColor,
fontFamily: Constant.ROBOTO_BOLD,
),
),
GroceryViewList(
listGrocery: Helper.getVegetableList(),
isFromHome: true,
)
],
),
),
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/home/TabHomePage.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/pages/account/AccountsPage.dart';
import 'package:flutter_grocery/pages/cart/CartDetailsPage.dart';
import 'package:flutter_grocery/pages/home/HomePage.dart';
import 'package:flutter_grocery/pages/orders/OrdersPage.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/widgets/HomeAppBar.dart';
import 'package:flutter_grocery/widgets/MainBottonNavBar.dart';
class TabHomePage extends StatefulWidget {
@override
_TabHomePageState createState() => _TabHomePageState();
}
class _TabHomePageState extends State<TabHomePage> {
int selectedIndex = 0;
String title = Constant.APP_NAME;
final List<String> tabNames = [
Constant.APP_NAME,
Constant.MY_CART,
Constant.ORDERS,
Constant.ACCOUNT
];
final List<Widget> widgeList = <Widget>[
HomePage(),
CartDetailsPage(),
OrdersPage(),
AccountsPage(),
];
void _onItemTapped(int index) {
setState(() {
selectedIndex = index;
title = tabNames[index];
});
}
@override
Widget build(BuildContext context) {
print(title);
return Scaffold(
appBar: HomeAppBar(
text: title,
isCenterTitle: false,
context: context,
selectedIndex: selectedIndex),
body: widgeList[selectedIndex],
bottomNavigationBar: MainBottomNavBar(
selectedIndex: selectedIndex, onTabPress: _onItemTapped));
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/search/SearchGroceryPage.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/pages/grocery_list/list/GroceryViewList.dart';
import 'package:flutter_grocery/pages/modal/Grocery.dart';
import 'package:flutter_grocery/pages/search/SearchEmptyPage.dart';
import 'package:flutter_grocery/util/Helper.dart';
import 'package:flutter_grocery/widgets/SearchWidget.dart';
class SearchGroceryPage extends StatefulWidget {
@override
_SearchGroceryPageState createState() => _SearchGroceryPageState();
}
class _SearchGroceryPageState extends State<SearchGroceryPage> {
final String textSearch = "";
final List<Grocery> listGrocery = Helper.getVegetableList();
List<Grocery> listData = [];
void onSearchPackPress() {
Navigator.of(context).pop();
}
void onSearchTyping(String data) {
// print(data);
listData.clear();
if (data != '') {
List<Grocery> listData1 = [];
for (Grocery item in listGrocery) {
if (item.name.toLowerCase().contains(data.toLowerCase())) {
print(item.name);
listData1.add(item);
}
}
setState(() {
listData.addAll([]);
listData.addAll(listData1);
});
} else {
setState(() {
listData.addAll([]);
});
}
}
void onSearchClear() {
Navigator.of(context).pop();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: SearchWidget(
textSearch: textSearch,
onPress: onSearchPackPress,
onClear: onSearchClear,
onSearch: onSearchTyping,
),
body: listData.length == 0
? SearchEmptyPage()
: GroceryViewList(listGrocery: listData),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/pages/search/SearchEmptyPage.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/widgets/TextWidget.dart';
class SearchEmptyPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'${Constant.PATH_IMAGE}/app_icon.jpg',
width: MediaQuery.of(context).size.width / 2.5,
height: MediaQuery.of(context).size.width / 4.5,
// color: Colors.grey[500],
),
SizedBox(
height: Constant.HALF_PADDING_VIEW,
),
TextWidget(
text: "No grocery found",
fontColor: Colors.grey[500],
fontSize: 20,
fontFamily: Constant.ROBOTO_MEDIUM,
)
],
),
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/util/Router.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/pages/account/AccountsPage.dart';
import 'package:flutter_grocery/pages/auth/LandingPage.dart';
import 'package:flutter_grocery/pages/auth/LoginPage.dart';
import 'package:flutter_grocery/pages/auth/VerifyOTPPage.dart';
import 'package:flutter_grocery/pages/cart/CartDetailsPage.dart';
import 'package:flutter_grocery/pages/grocery_list/detail/GroceryDetailPage.dart';
import 'package:flutter_grocery/pages/grocery_list/list/GroceryListPage.dart';
import 'package:flutter_grocery/pages/home/HomePage.dart';
import 'package:flutter_grocery/pages/home/TabHomePage.dart';
import 'package:flutter_grocery/pages/orders/OrderDetailsPage.dart';
import 'package:flutter_grocery/pages/orders/OrdersPage.dart';
import 'package:flutter_grocery/pages/search/SearchGroceryPage.dart';
class Router {
static const LANDING = "./landing";
static const LOGIN = "./login";
static const OTP = "./otp";
static const TABS = "./tabs";
static const SEARCH = "./search";
static const HOME = "./home";
static const GROCERY_LIST = "./groceryList";
static const GROCERY_DETAIL = "./groceryDetail";
static const ORDERS = "./orders";
static const ORDER_DETAILS = "./orderDetail";
static const CART_DETAILS = "./cartDetail";
static const ACCOUNTS = "./accounts";
static Map<String, WidgetBuilder> getRoutePage() {
return <String, WidgetBuilder>{
Router.LANDING: (BuildContext context) => LandingPage(),
Router.LOGIN: (BuildContext context) => LoginPage(),
Router.OTP: (BuildContext context) => VerifyOTPPage(),
Router.TABS: (BuildContext context) => TabHomePage(),
Router.SEARCH: (BuildContext context) => SearchGroceryPage(),
Router.HOME: (BuildContext context) => HomePage(),
Router.GROCERY_LIST: (BuildContext context) => GroceryListPage(),
Router.GROCERY_DETAIL: (BuildContext context) => GroceryDetailPage(),
Router.ORDERS: (BuildContext context) => OrdersPage(),
Router.ORDER_DETAILS: (BuildContext context) => OrderDetailsPage(),
Router.CART_DETAILS: (BuildContext context) => CartDetailsPage(),
Router.ACCOUNTS: (BuildContext context) => AccountsPage(),
};
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/util/Pallete.dart | import 'package:flutter/material.dart';
class Pallete {
static var lightPrimaryColor = Colors.deepOrange[300]; //Color(0x09C25E);
static const primaryColor = Color(0xFF09C25E);
static const toolbarColor = primaryColor;
static const toolbarItemColor = Colors.white;
static const primaryColorDark = Color(0xFF09C25E);
static const primaryColorAccent = Color(0xFF09C25E);
static const textColor = Colors.black;
static var textSubTitle = Colors.grey[500];
static var appBgColor = Colors.grey[100];
static var countViewColor = Colors.grey[300];
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/util/StyleUtil.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/util/Pallete.dart';
class StyleUtil {
static const textSearchStyle =
TextStyle(color: Colors.white, fontSize: Constant.APP_BAR_TEXT_FONT);
static const textAddQuantityStyle =
TextStyle(color: Pallete.textColor, fontSize: Constant.TEXT_FONT);
static const textSearchHintStyle =
TextStyle(color: Colors.white54, fontSize: Constant.APP_BAR_TEXT_FONT);
static ThemeData themeData = ThemeData(
// primarySwatch: ColorUtil.primarySwatch,
visualDensity: VisualDensity.adaptivePlatformDensity,
primaryColor: Colors.black,
accentColor: Colors.black,
fontFamily: Constant.ROBOTO_REGULAR,
buttonTheme: ButtonThemeData(minWidth: 1000, height: 50));
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/util/Helper.dart | import 'package:flutter/material.dart';
import 'package:flutter_grocery/pages/modal/Cart.dart';
import 'package:flutter_grocery/pages/modal/Orders.dart';
import 'package:flutter_grocery/util/Constant.dart';
import 'package:flutter_grocery/pages/modal/Grocery.dart';
class Helper {
static List<Grocery> getVegetableList() {
return [
Grocery(
name: 'Spinach',
price: 50,
size: '2kg',
image: '${Constant.PATH_IMAGE}/spinach.jpg',
details: Constant.PRODUCT_DETAILS),
Grocery(
name: 'Japanese Cabbage',
price: 80,
size: '1kg',
image: '${Constant.PATH_IMAGE}/cabbage.jpg',
details: Constant.PRODUCT_DETAILS),
Grocery(
name: 'Tomato',
price: 20,
size: '1kg',
image: '${Constant.PATH_IMAGE}/tomato.jpeg',
details: Constant.PRODUCT_DETAILS),
Grocery(
name: 'Broccoli',
price: 120,
size: '2kg',
image: '${Constant.PATH_IMAGE}/broccoli.jpg',
details: Constant.PRODUCT_DETAILS),
Grocery(
name: 'Garlic',
price: 200,
size: '4kg',
image: '${Constant.PATH_IMAGE}/garlic.jpeg',
details: Constant.PRODUCT_DETAILS),
Grocery(
name: 'Green Paprica',
price: 150,
size: '2kg',
image: '${Constant.PATH_IMAGE}/capcicum.jpg',
details: Constant.PRODUCT_DETAILS),
Grocery(
name: 'Red Onion',
price: 100,
size: '3kg',
image: '${Constant.PATH_IMAGE}/redonion.jpg',
details: Constant.PRODUCT_DETAILS),
Grocery(
name: 'Red Chilli',
price: 80,
size: '2kg',
image: '${Constant.PATH_IMAGE}/redchilli.jpg',
details: Constant.PRODUCT_DETAILS),
Grocery(
name: 'Green Chilli',
price: 150,
size: '4kg',
image: '${Constant.PATH_IMAGE}/greenchilli.jpg',
details: Constant.PRODUCT_DETAILS),
Grocery(
name: 'Green Spinach',
price: 150,
size: '6kg',
image: '${Constant.PATH_IMAGE}/spinach.jpg',
details: Constant.PRODUCT_DETAILS),
];
}
static List<Orders> getOrderList() {
return [
Orders(
status: Status(
name: Constant.WAITING_PAYMENT,
bgColor: Colors.orange[100],
textColor: Colors.orange),
date: '06/12/2020',
transactionId: '#321DERS',
deliveredTo: 'Sion Home',
totalPayment: '279'),
Orders(
status: Status(
name: Constant.ON_PROCESS,
bgColor: Colors.blue[100],
textColor: Colors.blue),
date: '09/12/2020',
transactionId: '#390DERS',
deliveredTo: 'Sion Home',
totalPayment: '581'),
Orders(
status: Status(
name: Constant.DELIVERED,
bgColor: Colors.green[100],
textColor: Colors.green),
date: '26/08/2020',
transactionId: '#123BUSE',
deliveredTo: 'Sion Home',
totalPayment: '1000'),
Orders(
status: Status(
name: Constant.FAILED,
bgColor: Colors.red[100],
textColor: Colors.red),
date: '06/12/2020',
transactionId: '#621BASE',
deliveredTo: 'Sion Home',
totalPayment: '111'),
Orders(
status: Status(
name: Constant.WAITING_PAYMENT,
bgColor: Colors.orange[100],
textColor: Colors.orange),
date: '06/12/2020',
transactionId: '#321DERS',
deliveredTo: 'Sion Home',
totalPayment: '279'),
Orders(
status: Status(
name: Constant.WAITING_PAYMENT,
bgColor: Colors.orange[100],
textColor: Colors.orange),
date: '06/12/2020',
transactionId: '#321DERS',
deliveredTo: 'Sion Home',
totalPayment: '279'),
Orders(
status: Status(
name: Constant.ON_PROCESS,
bgColor: Colors.blue[100],
textColor: Colors.blue),
date: '09/12/2020',
transactionId: '#390DERS',
deliveredTo: 'Sion Home',
totalPayment: '581'),
Orders(
status: Status(
name: Constant.DELIVERED,
bgColor: Colors.green[100],
textColor: Colors.green),
date: '26/08/2020',
transactionId: '#123BUSE',
deliveredTo: 'Sion Home',
totalPayment: '1000'),
Orders(
status: Status(
name: Constant.FAILED,
bgColor: Colors.red[100],
textColor: Colors.red),
date: '06/12/2020',
transactionId: '#621BASE',
deliveredTo: 'Sion Home',
totalPayment: '111'),
Orders(
status: Status(
name: Constant.WAITING_PAYMENT,
bgColor: Colors.orange[100],
textColor: Colors.orange),
date: '06/12/2020',
transactionId: '#321DERS',
deliveredTo: 'Sion Home',
totalPayment: '279'),
];
}
static List<Cart> getCartDetails() {
List groceryList = getVegetableList();
return [
Cart(grocery: groceryList[0], quantity: 2),
Cart(grocery: groceryList[1], quantity: 20),
Cart(grocery: groceryList[2], quantity: 4),
Cart(grocery: groceryList[3], quantity: 7),
Cart(grocery: groceryList[4], quantity: 1),
// Cart(grocery: groceryList[5], quantity: 16),
];
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/lib/util/Constant.dart | class Constant {
static const String APP_NAME = "Grocery";
static const String USER_NAME = "Yuvraj Pandey";
static const String SPLASH_TEXT = "Your daily needs";
static const String WELCOME = "Welcome To";
static const String WELCOME_TEXT =
"Shop everything you need without the trip to the supermarket";
static const String TnC =
"By Login you accept our Terms of use & Privacy Policy";
static const String LOGIN = "Login";
static const String CREATE_ACCOUNT = "Create Account";
static const WELCOME_BACK = "Welcome Back";
static const GET_STARTED = "Let's get started";
static const ALREADY_HAVE_ACCOUNT =
"If you already have $APP_NAME account, enter your phone number below";
static const TOP_PICKS = "Create account to see our top picks for you";
static const STANDARD_RATES_APPLY =
"Standard text messaging and data rates may apply";
static const INVALID_MOBILE_NUMBER = "Invalid mobile number";
static const INVALID_OTP_CODE = "Invalid OTP Code";
static const CONTINUE = "Continue";
static const HINT_MOBILE_NUMBER = "Mobile Number";
static const HINT_MOBILE_EXAMPLE = "eg. 9850988971";
static const HINT_OTP_NUMBER = "OTP Code";
static const HINT_OTP_EXAMPLE = "eg. 4567";
static const DUMMY_MOBILE_EXAMPLE = "9850988971";
static const RESEND_CODE = "Resend Code";
static const VERIFY_OTP = "Enter OTP";
static const VERIFY_NUMBER = "Verify your number";
static const HINT_ENTER_CODE = "Enter the 4-digit code that we sent to you";
static const ROBOTO_REGULAR = "RobotoRegular";
static const ROBOTO_MEDIUM = "RobotoMedium";
static const ROBOTO_BOLD = "RobotoBold";
static const LOOKING_FOR = "What are you looking for?";
static const VEGATABLES = "Vegetables";
static const FRUITS = "Fruits";
static const MEATS = "Meats";
static const SEAFOOD = "Seafood";
static const MILK_EGG = "Milk & Egg";
static const FROZEN = "Frozen";
static const BREAD = "Bread";
static const ORGANIC = "Organic";
static const FILTER = "Filter";
static const SORT = "Sort";
static const PRODUCT_DETAILS =
"Botanically, a tomato is a fruit—a berry, consisting of the ovary, together with its seeds, of a flowering plant. However, the tomato is considered a \"culinary vegetable\" because it has a much lower sugar content than culinary fruits; it is typically served as part of a salad or main course of a meal, rather than as a dessert. Tomatoes are not the only food source with this ambiguity; bell peppers, cucumbers, green beans, eggplants, avocados, and squashes of all kinds (such as zucchini and pumpkins) are all botanically fruit, yet cooked as vegetables. This has led to legal dispute in the United States. In 1887, U.S. tariff laws that imposed a duty on vegetables, but not on fruit, caused the tomato's status to become a matter of legal importance. The U.S. Supreme Court settled this controversy on May 10, 1893, by declaring that the tomato is a vegetable, based on the popular definition that classifies vegetables by use—they are generally served with dinner and not dessert (Nix v. Hedden (149 U.S. 304)). The holding of this case applies only to the interpretation of the Tariff of 1883, and the court did not purport to reclassify the tomato for botanical or other purposes.";
static const TRANSACTION_ID = "Transaction ID";
static const DELIVERED_TO = "Delivered To";
static const TOTAL_PAYMENT = "Total Payment";
static const TOTAL = "Total";
static const RUPEE = "₹";
static const PRODUCT_DETAIL = "Product Details";
static const ORDER_STATUS = "Order Status";
static const DESTINATION = "Destination";
static const COURIER = "Courier";
static const BOOKING_DATE = "Date of Booking";
static const PRODUCT_ADDRESS =
"4897 Taylor Street, Old Forge, New York, 13420";
static const CHECKOUT = "Checkout";
// Order Status Types
static const WAITING_PAYMENT = "Waiting For Payment";
static const FAILED = "Failed";
static const ON_PROCESS = "On Process";
static const DELIVERED = "Delivered";
static const PREPARING_ORDER = "Preparing order";
static const ORDER_DISPATCHED = "Order dispatched";
static const DELIVER_ORDER = "Deliver order";
static const READY_COLLECT = "Ready to collect";
// Tabs
static const SHOP = "Shop";
static const MY_CART = "My Cart";
static const ORDERS = "Orders";
static const ACCOUNT = "Account";
// Hero Type
static const HERO_IMAGE = "HERO_IMAGE";
static const PATH_IMAGE = "./assets/images";
// Dimension
static const double BUTTON_FONT = 16;
static const double TEXT_FONT = 16;
static const double SUB_TEXT_FONT = 14;
static const double SMALL_TEXT_FONT = 12;
static const double HINT_TEXT_FONT = 18;
static const double APP_BAR_TEXT_FONT = 20;
static const double PRICE_TEXT_FONT = 23;
static const double BIG_TEXT_FONT = 34;
static const double MEDIUM_TEXT_FONT = 28;
static const double PADDING_VIEW = 20;
static const double HALF_PADDING_VIEW = 10;
static const double CARD_ELEVATION = 1;
static const double ORDER_STATUS_HEIGHT = 30;
static const double BORDER_RADIUS = 20;
static const double MARGIN_50 = 60;
static const double BUTTON_HEIGHT = 45;
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery | mirrored_repositories/Fluttereo/Flutter-UI-Kit/flutter_grocery/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:flutter_grocery/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/Fluttereo/Flutter-Demo | mirrored_repositories/Fluttereo/Flutter-Demo/lib/button.dart | import 'package:flutter/material.dart';
class ButtonDemo extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return new ButtonDemoState();
}
}
class ButtonDemoState extends State<ButtonDemo> {
int number = 0;
void subtractNumbers() {
setState(() {
number = number - 1;
});
}
void addNumbers() {
setState(() {
number = number + 1;
});
}
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text("Raised Button"),
),
body: new Center(
child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Text(
'$number',
style: new TextStyle(
fontWeight: FontWeight.bold,
fontSize: 160.0,
fontFamily: 'Roboto',
),
),
new Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
new RaisedButton(
padding: const EdgeInsets.all(8.0),
textColor: Colors.white,
color: Colors.blue,
onPressed: addNumbers,
child: new Text("Add"),
),
new RaisedButton(
onPressed: subtractNumbers,
textColor: Colors.white,
color: Colors.red,
padding: const EdgeInsets.all(8.0),
child: new Text(
"Subtract",
),
),
],
)
],
),
));
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-Demo | mirrored_repositories/Fluttereo/Flutter-Demo/lib/listview.dart | import 'package:flutter/material.dart';
class ListViewDemo extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return new ListViewState();
}
}
class ListViewState extends State<ListViewDemo> {
Container showContent(int title, int desciption) {
return new Container(
margin: const EdgeInsets.all(5.0),
child: new Card(
color: Colors.white70,
elevation: 5.0,
child: new Center(
child: new Container(
color: Colors.white70,
child: new Column(
children: <Widget>[
new FadeInImage(
placeholder: new AssetImage("images/ic_placeholder.png"),
image: new NetworkImage(
'https://wallpaperbrowse.com/media/images/3848765-wallpaper-images-download.jpg'),
),
new Container(
padding: const EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0),
child: new Column(children: <Widget>[
new Text(
"Title $title",
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: new TextStyle(
fontSize: 20.0,
fontFamily: 'roboto',
fontStyle: FontStyle.normal),
),
new Text(
"Description $desciption",
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: new TextStyle(
fontSize: 20.0,
fontFamily: 'roboto',
fontStyle: FontStyle.normal),
)
]))
],
),
),
),
),
);
}
@override
Widget build(BuildContext context) {
// TODO: implement build
return new Scaffold(
backgroundColor: Colors.white,
appBar: new AppBar(
title: new Text("ListView"),
),
body: new ListView(
scrollDirection: Axis.vertical,
children: <Widget>[
showContent(1, 1),
showContent(2, 2),
showContent(3, 3),
showContent(4, 4),
showContent(5, 5),
showContent(6, 6),
showContent(7, 7),
showContent(8, 8),
showContent(9, 9),
showContent(10, 10),
showContent(12, 12),
showContent(13, 13),
showContent(14, 14),
showContent(15, 15),
showContent(16, 16),
showContent(17, 17),
showContent(18, 18),
showContent(19, 19),
showContent(20, 20),
],
));
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-Demo | mirrored_repositories/Fluttereo/Flutter-Demo/lib/form.dart | import 'package:flutter/material.dart';
class FormDemo extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return new FormFieldState();
}
}
class FormFieldState extends State<FormDemo> {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text("Forms"),
actions: <Widget>[
new IconButton(icon: const Icon(Icons.save), onPressed: () {})
],
),
body: new Column(
children: <Widget>[
new ListTile(
leading: const Icon(Icons.person),
title: new TextField(
decoration: new InputDecoration(
hintText: "Name",
contentPadding: const EdgeInsets.all(15.0),
),
),
),
new ListTile(
leading: const Icon(Icons.phone),
title: new TextField(
decoration: new InputDecoration(
hintText: "Phone",
contentPadding: const EdgeInsets.all(15.0)),
keyboardType: TextInputType.phone,
maxLength: 10,
),
),
new ListTile(
leading: const Icon(Icons.email),
title: new TextField(
decoration: new InputDecoration(
hintText: "Email",
contentPadding: const EdgeInsets.all(15.0),
),
),
),
new ListTile(
leading: const Icon(Icons.label),
title: const Text('Nick'),
subtitle: const Text('None'),
),
new ListTile(
leading: new Icon(Icons.today),
title: new Text('Birthday'),
subtitle: new Text('April 24, 1992')),
new ListTile(
leading: new Icon(Icons.group),
title: new Text('Contact group'),
subtitle: new Text('Not specified'),
)
],
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-Demo | mirrored_repositories/Fluttereo/Flutter-Demo/lib/gridview.dart | import 'package:flutter/material.dart';
class GridViewDemo extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return new GridViewState();
}
}
class GridViewState extends State<GridViewDemo> {
Container showContent(String title, String desciption) {
return new Container(
child: new Column(
children: <Widget>[
new Container(
child: new Stack(
children: <Widget>[
new FadeInImage(
placeholder: new AssetImage("images/ic_placeholder.png"),
image: new NetworkImage(
'https://wallpaperbrowse.com/media/images/3848765-wallpaper-images-download.jpg'),
)
],
)),
// new Image.network(
// 'http://www.hcxypz.com/data/out/149/648637.jpeg',
// fit: BoxFit.scaleDown,
// width: 100.0,
// height: 100.0,
// ),
new Container(
padding: const EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0),
child: new Column(children: <Widget>[
new Text(
"$title",
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: new TextStyle(
fontSize: 20.0,
fontFamily: 'roboto',
fontStyle: FontStyle.normal),
),
new Text(
"$desciption",
textAlign: TextAlign.left,
textDirection: TextDirection.ltr,
style: new TextStyle(
fontSize: 20.0,
fontFamily: 'roboto',
fontStyle: FontStyle.normal),
)
]))
],
),
);
}
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text("GridView"),
),
body: new GridView.count(
padding: const EdgeInsets.all(10.0),
crossAxisCount: 2,
children: new List<Widget>.generate(30, (index) {
return new GridTile(
child: new Container(
margin: const EdgeInsets.all(8.0),
child: new Card(
color: Colors.white70,
elevation: 5.0,
child: new Center(
child: showContent("tile", "$index"),
)),
),
);
}),
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-Demo | mirrored_repositories/Fluttereo/Flutter-Demo/lib/first_screen.dart | import 'package:flutter/material.dart';
import 'package:meta/meta.dart';
import 'DrawerItem.dart';
class FirstScreen extends StatefulWidget {
final DrawerItem drawerItem;
FirstScreen({Key key, @required this.drawerItem}) : super(key: key);
@override
FirstScreenState createState() {
return new FirstScreenState();
}
}
class FirstScreenState extends State<FirstScreen> {
@override
Widget build(BuildContext context) {
// TODO: implement build
// return new Scaffold(
//
// )
return new Center(
child: new Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Icon(
widget.drawerItem.icon,
size: 54.0,
),
new Text(
widget.drawerItem.title,
style: new TextStyle(fontSize: 48.0, fontWeight: FontWeight.w300),
),
],
));
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-Demo | mirrored_repositories/Fluttereo/Flutter-Demo/lib/main.dart | import 'package:flutter/material.dart';
import 'home.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return new Center(
child: new MaterialApp(
title: 'Flutter Demo',
theme: new ThemeData(
primarySwatch: Colors.teal,
),
home: new HomeScreen(title: 'Flutter Demo'),
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-Demo | mirrored_repositories/Fluttereo/Flutter-Demo/lib/drawer.dart | import 'package:flutter/material.dart';
import 'DrawerItem.dart';
import 'first_screen.dart';
class NavigationDrawerDemo extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return new NavigationDrawerState();
}
}
class NavigationDrawerState extends State<NavigationDrawerDemo> {
int _selectedIndex = 0;
final drawerItems = [
new DrawerItem("Aeroplane", Icons.local_airport),
new DrawerItem("Pizza", Icons.local_pizza),
new DrawerItem("Coffee", Icons.local_cafe)
];
_getDrawerItemScreen(int pos) {
return new FirstScreen(drawerItem: drawerItems[_selectedIndex]);
}
_onSelectItem(int index) {
setState(() {
_selectedIndex = index;
_getDrawerItemScreen(_selectedIndex);
});
Navigator.of(context).pop(); // close the drawer
// Navigator.push(
// context,
// new MaterialPageRoute(
// builder: (context) => _getDrawerItemScreen(_selectedIndex),
// ),
// );
}
@override
Widget build(BuildContext context) {
var drawerOptions = <Widget>[];
for (var i = 0; i < drawerItems.length; i++) {
var d = drawerItems[i];
drawerOptions.add(new ListTile(
leading: new Icon(d.icon),
title: new Text(
d.title,
style: new TextStyle(fontSize: 18.0, fontWeight: FontWeight.w400),
),
selected: i == _selectedIndex,
onTap: () => _onSelectItem(i),
));
}
return new Scaffold(
appBar: new AppBar(
title: new Text("Navigation Drawer"),
),
drawer: new Drawer(
child: new Column(
children: <Widget>[
new UserAccountsDrawerHeader(
accountName: new Text(
"Yuvraj Pandey",
style: new TextStyle(
fontSize: 18.0, fontWeight: FontWeight.w500),
),
accountEmail: new Text(
"[email protected]",
style: new TextStyle(
fontSize: 18.0, fontWeight: FontWeight.w500),
)),
new Column(children: drawerOptions)
],
),
),
body: _getDrawerItemScreen(_selectedIndex),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-Demo | mirrored_repositories/Fluttereo/Flutter-Demo/lib/DrawerItem.dart | import 'package:flutter/material.dart';
class DrawerItem {
String title;
IconData icon;
DrawerItem(this.title, this.icon);
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-Demo | mirrored_repositories/Fluttereo/Flutter-Demo/lib/home.dart | import 'package:flutter/material.dart';
import 'button.dart';
import 'drawer.dart';
import 'form.dart';
import 'gridview.dart';
import 'listview.dart';
class HomeScreen extends StatefulWidget {
HomeScreen({Key key, this.title}) : super(key: key);
final String title;
@override
_HomeScreenState createState() => new _HomeScreenState();
}
class _HomeScreenState extends State<HomeScreen> {
void switchView(StatefulWidget widget) {
Navigator.push(
context,
new MaterialPageRoute(builder: (context) {
return widget;
}),
);
}
ListTile renderViews(String title, StatefulWidget widget) {
return new ListTile(
onTap: () {
switchView(widget);
},
title: new Text(title,
style: new TextStyle(fontWeight: FontWeight.w500, fontSize: 20.0)),
// subtitle: new Text(''),
leading: new Icon(
Icons.arrow_forward,
color: Colors.green,
),
);
}
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text(widget.title),
),
body: new ListView(
children: <Widget>[
renderViews('Button', new ButtonDemo()),
renderViews('ListView', new ListViewDemo()),
renderViews('GridView', new GridViewDemo()),
renderViews('Forms', new FormDemo()),
renderViews('Navigation Drawer', new NavigationDrawerDemo()),
],
),
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-Demo | mirrored_repositories/Fluttereo/Flutter-Demo/lib/main_old.dart | import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Flutter Demo',
theme: new ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or press Run > Flutter Hot Reload in IntelliJ). Notice that the
// counter didn't reset back to zero; the application is not restarted.
primarySwatch: Colors.green,
),
home: new MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
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() => new _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.
if(_counter >= 10) {
_counter--;
}else if(_counter <= 5){
_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 new Scaffold(
appBar: new 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: new Text(widget.title),
),
body: new Center(
// Center is a layout widget. It takes a single child and positions it
// in the middle of the parent.
child: new Column(
// Column is also 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 paint" (press "p" in the console where you ran
// "flutter run", or select "Toggle Debug Paint" from the Flutter tool
// window in IntelliJ) 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>[
new Text(
'You have pushed the button this many times:',
),
new Text(
'$_counter',
style: Theme.of(context).textTheme.display1,
),
],
),
),
floatingActionButton: new FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: new Icon(Icons.android),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
| 0 |
mirrored_repositories/Fluttereo/Flutter-Demo | mirrored_repositories/Fluttereo/Flutter-Demo/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 '../lib/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(new 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/flutter_banana_challenge | mirrored_repositories/flutter_banana_challenge/lib/main.dart | import 'package:flutter/material.dart';
import 'package:flutter_banana_challenge/constants/constants.dart';
import 'package:flutter_banana_challenge/viewModels/product_view_model.dart';
import 'package:flutter_banana_challenge/views/routes/routes.dart';
import 'package:provider/provider.dart';
import 'package:flutter_banana_challenge/services/auth_service.dart';
import 'package:flutter_banana_challenge/viewModels/auth_view_model.dart';
import 'package:flutter_banana_challenge/views/views.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
final authService = AuthService();
return MultiProvider(
providers: [
ChangeNotifierProvider<ProductViewModel>(
create: (context) => ProductViewModel()),
ChangeNotifierProvider<AuthViewModel>(
create: (context) => AuthViewModel(authService: authService),
)
],
child: MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Banana Challenge',
routes: routes,
theme: ThemeData(
colorScheme: const ColorScheme.light().copyWith(
primary: primaryColor,
),
),
home: const AuthWrapperScreen(),
),
);
}
}
| 0 |
mirrored_repositories/flutter_banana_challenge/lib | mirrored_repositories/flutter_banana_challenge/lib/viewModels/auth_view_model.dart | import 'package:flutter/material.dart';
import 'package:flutter_banana_challenge/models/user_model.dart';
import '../services/auth_service.dart';
class AuthViewModel extends ChangeNotifier {
final AuthService authService;
AuthViewModel({required this.authService});
//constructor to check stoarage for token
AuthViewModel.checkAuthStatus({required this.authService}) {
checkAuthStatus();
}
String token = '';
UserModel _user = UserModel.empty;
UserModel get user => _user;
bool get isLoggedIn => token != '';
Future<bool> login(String email, String password) async {
final user = await authService.login(email, password);
if (user == UserModel.empty) return false;
_user = user;
notifyListeners();
return true;
}
Future<void> logout() async {
await authService.logout();
_user = UserModel.empty;
token = '';
notifyListeners();
}
Future<void> checkAuthStatus() async {
final tokenResponse = await authService.isAuthenticated();
token = tokenResponse;
notifyListeners();
}
}
| 0 |
mirrored_repositories/flutter_banana_challenge/lib | mirrored_repositories/flutter_banana_challenge/lib/viewModels/product_view_model.dart | import 'dart:async';
import 'package:easy_debounce/easy_debounce.dart';
import 'package:flutter/material.dart';
import 'package:flutter_banana_challenge/models/product_model.dart';
import 'package:flutter_banana_challenge/services/product_service.dart';
class ProductViewModel extends ChangeNotifier {
final ProductService productService = ProductService();
List<ProductModel> products = [];
List<ProductModel> searchResults = [];
bool loading = false;
String query = '';
Timer? debounce;
Future<void> getProducts() async {
loading = true;
products = await productService.getProducts();
loading = false;
notifyListeners();
}
Future<void> searchProducts(String query) async {
//Only search if the query is different
if (this.query != query) {
this.query = query;
//Implement a debouncer so it doesn't search on every keystroke
EasyDebounce.debounce(
'searchProducts',
const Duration(milliseconds: 500),
() async {
//Search products
searchResults = await productService.searchProducts(query);
notifyListeners();
},
);
}
}
}
| 0 |
mirrored_repositories/flutter_banana_challenge/lib | mirrored_repositories/flutter_banana_challenge/lib/constants/constants.dart | import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
/// url is here because it's a public api, if it wasn't it should be in env variables
const url = 'https://dummyjson.com';
final dio = Dio();
const primaryColor = Color(0xff9e007e);
| 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.