Skip to content

Commit

Permalink
authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
Dante291 committed Sep 24, 2023
1 parent 9047e71 commit 289a4e2
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 7 deletions.
1 change: 0 additions & 1 deletion lib/Providers/button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class button with ChangeNotifier {

void Togglecart() {
ad.isinCart = false;
print(ad);
notifyListeners();
}
}
29 changes: 25 additions & 4 deletions lib/Screens/auth_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class _AuthCardState extends State<AuthCard> {
keyboardType: TextInputType.visiblePassword,
validator: (value) {
if (value!.isEmpty || value.length < 6) {
return 'Invalid Email';
return 'Invalid password';
}
;
},
Expand Down Expand Up @@ -240,9 +240,30 @@ class _AuthCardState extends State<AuthCard> {
),
TextButton(
onPressed: _switchauthMode,
child: Text(
(_authMode == AuthMode.Login ? 'Sign-In' : 'LogIn') +
' Instead'),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
DecoratedBox(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width:
2.0, // Adjust the thickness of the line as needed
color: Theme.of(context)
.primaryColor, // Specify the color of the line
),
),
),
child: Text(
_authMode == AuthMode.Login ? 'Sign-In' : 'LogIn',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
),
)),
Text(' Instead'),
],
),
)
],
),
Expand Down
20 changes: 19 additions & 1 deletion lib/Screens/order_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,25 @@ class _orderScreenState extends State<orderScreen> {
.fetchData()
.then((value) => setState(() {
_isloading = false;
}));
}))
.catchError((_) {
showDialog<Null>(
context: context,
builder: (context) {
return AlertDialog(
title: Text('An error occurred!'),
content: Text('Something went wrong'),
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Text('Okay'))
],
);
},
);
});
super.initState();
}

Expand Down
17 changes: 17 additions & 0 deletions lib/Screens/product_overview_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,23 @@ class _productOverviewScreenState extends State<productOverviewScreen> {
setState(() {
_isLoading = false;
});
}).catchError((error) {
showDialog<Null>(
context: context,
builder: (context) {
return AlertDialog(
title: Text('An error occurred!'),
content: Text('Something went wrong'),
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Text('Okay'))
],
);
},
);
});
super.initState();
}
Expand Down
21 changes: 20 additions & 1 deletion lib/Screens/user_product_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,26 @@ import 'package:shop_app/Widgets/userProductitem.dart';
class UserProductScreen extends StatelessWidget {
static const routename = '/user-product';
Future<void> _refreshProducts(BuildContext context) async {
await Provider.of<Products>(context, listen: false).fetchData();
await Provider.of<Products>(context, listen: false)
.fetchData()
.catchError((_) {
showDialog<Null>(
context: context,
builder: (context) {
return AlertDialog(
title: Text('An error occurred!'),
content: Text('Something went wrong'),
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Text('Okay'))
],
);
},
);
});
}

@override
Expand Down

0 comments on commit 289a4e2

Please sign in to comment.