diff --git a/lib/screens/cart/cart_screen.dart b/lib/screens/cart/cart_screen.dart index 517dfec..74f5da6 100644 --- a/lib/screens/cart/cart_screen.dart +++ b/lib/screens/cart/cart_screen.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:thesis_shop/widgets/user_switch.dart'; class CartScreen extends StatelessWidget { const CartScreen({Key? key}) : super(key: key); @@ -6,7 +7,10 @@ class CartScreen extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBar(title: const Text('Warenkorb')), + appBar: AppBar( + title: const Text('Warenkorb'), + actions: [UserSwitch(isOn: true, onChanged: (_) {})], + ), ); } } diff --git a/lib/screens/product_list/product_list_screen.dart b/lib/screens/product_list/product_list_screen.dart index 57dd1d1..ee5e8de 100644 --- a/lib/screens/product_list/product_list_screen.dart +++ b/lib/screens/product_list/product_list_screen.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:thesis_shop/models/product.dart'; +import 'package:thesis_shop/widgets/user_switch.dart'; import 'cart_button_overlay.dart'; import 'product_list.dart'; @@ -18,7 +19,10 @@ class ProductListScreen extends StatelessWidget { Widget build(BuildContext context) { const products = _productPlaceholder; return Scaffold( - appBar: AppBar(title: const Text('Thesis Shop')), + appBar: AppBar( + title: const Text('Thesis Shop'), + actions: [UserSwitch(isOn: true, onChanged: (_) {})], + ), body: const CartButtonOverlay( child: ProductList(products: _productPlaceholder), ), diff --git a/lib/widgets/user_switch.dart b/lib/widgets/user_switch.dart new file mode 100644 index 0000000..6f22562 --- /dev/null +++ b/lib/widgets/user_switch.dart @@ -0,0 +1,26 @@ +import 'package:flutter/material.dart'; + +class UserSwitch extends StatelessWidget { + final bool isOn; + final ValueChanged onChanged; + const UserSwitch({ + Key? key, + required this.isOn, + required this.onChanged, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Row( + mainAxisSize: MainAxisSize.min, + children: [ + const Icon(Icons.account_circle), + Switch( + value: isOn, + onChanged: onChanged, + activeColor: Colors.green, + ) + ], + ); + } +}