From 592fc12e5711d5b4b90167b6e0ebdc22c0e9099d Mon Sep 17 00:00:00 2001 From: Maheen Ilyas Date: Fri, 19 Jul 2024 20:59:24 +0300 Subject: [PATCH] Resolved merge conflicts --- lib/pages/explore/explore.dart | 322 +++++++++++++++++---------------- lib/pages/modules/atoz.dart | 6 - pubspec.yaml | 2 +- 3 files changed, 172 insertions(+), 158 deletions(-) diff --git a/lib/pages/explore/explore.dart b/lib/pages/explore/explore.dart index 0249fd9..d75d143 100644 --- a/lib/pages/explore/explore.dart +++ b/lib/pages/explore/explore.dart @@ -1,175 +1,195 @@ -// ignore_for_file: unused_import - import 'dart:ui'; - import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:learn/pages/modules/atoz.dart'; -import 'package:learn/pages/modules/birds.dart'; -import 'package:learn/pages/modules/colours.dart'; -import 'package:learn/pages/modules/planets.dart'; -import 'package:learn/pages/modules/shapes.dart'; import 'package:learn/utils/constants.dart'; -import 'package:learn/utils/const_dimensions.dart'; import 'package:learn/utils/route/route_constant.dart'; +import '../../utils/const_dimensions.dart'; + // Explore Page -class ExplorePage extends StatefulWidget { +class ExplorePage extends StatelessWidget { const ExplorePage({super.key}); - @override - State createState() => _ExplorePageState(); -} - -class _ExplorePageState extends State { - bool _isLoading = true; - - @override - void initState() { - super.initState(); - _loadPrefs(); - } - - Future _loadPrefs() async { - await Provider.of(context, listen: false) - .loadFromPrefs(); - setState(() { - _isLoading = false; - }); - } - @override Widget build(BuildContext context) { - final themeProvider = Provider.of(context); - final provider = - Provider.of(context, listen: false); - List selectItem = provider.selectedItemList; - return _isLoading - ? Center(child: CircularProgressIndicator()) - : Scaffold( - appBar: AppBar( - title: const Text( - 'Explore', - style: TextStyle(fontWeight: FontWeight.bold), + return SafeArea( + child: CustomScrollView( + slivers: [ + SliverAppBar( + title: Padding( + padding: const EdgeInsets.fromLTRB(0, 12, 16, 4), + child: Text( + "Explore", + style: Theme.of(context) + .textTheme + .headlineLarge! + .copyWith(fontWeight: FontWeight.bold, fontSize: 30.0), ), - - ), - child: ClipRRect( - borderRadius: BorderRadius.circular(16), - child: Stack( - fit: StackFit.expand, - alignment: Alignment.center, - children: [ - ImageFiltered( - imageFilter: ImageFilter.blur( - sigmaX: 5, sigmaY: 5), - child: Image.asset( - AppConstants - .modules[index].thumbnailPath, - fit: BoxFit.cover, - ), - ), - Positioned.fill( - child: Align( - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Text( - AppConstants.modules[index].name, - style: Theme.of(context) - .textTheme - .headlineMedium! - .copyWith( - color: Colors.white, - fontWeight: FontWeight.bold, - shadows: [ - const Shadow( - color: Colors.black, - offset: Offset(2, 1), - blurRadius: 4, - ), - ], - ), - ), - Text( - AppConstants - .modules[index].description, - style: Theme.of(context) - .textTheme - .bodyMedium! - .copyWith( - color: Colors.white, - fontWeight: FontWeight.bold, - shadows: [ - const Shadow( - color: Colors.black, - offset: Offset(2, 1), - blurRadius: 2, - ), - ], - ), - ), - ], + ), + ), + SliverList( + delegate: SliverChildBuilderDelegate( + (context, index) { + return GestureDetector( + onTap: () => Navigator.push( + context, + AppConstants.modules[index].route, + ), + child: Container( + margin: const EdgeInsets.symmetric( + horizontal: 24, vertical: 12), + height: ConstantDimensions.heightExtraLarge * 4, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.2), + spreadRadius: 2, + blurRadius: 5, + offset: const Offset(0, 3), + ), + ], + ), + child: ClipRRect( + borderRadius: BorderRadius.circular(16), + child: Stack( + fit: StackFit.expand, + alignment: Alignment.center, + children: [ + ImageFiltered( + imageFilter: ImageFilter.blur(sigmaX: 5, sigmaY: 5), + child: Image.asset( + AppConstants.modules[index].thumbnailPath, + fit: BoxFit.cover, + ), + ), + Positioned.fill( + child: Align( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + AppConstants.modules[index].name, + style: Theme.of(context) + .textTheme + .headlineMedium! + .copyWith( + color: Colors.white, + fontWeight: FontWeight.bold, + shadows: [ + const Shadow( + color: Colors.black, + offset: Offset(2, 1), + blurRadius: 4, ), - ), + ], ), - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Container( - width: 40, - height: 40, - margin: const EdgeInsets.all(5), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: - BorderRadius.circular(10), - ), - child: - Consumer( - builder: (context, item, child) { - return IconButton( - onPressed: () { - if (item.selectedItemList - .contains(index)) { - item.removeList(index); - } else { - print(selectItem); - item.setList(index); - } - }, - icon: selectItem.contains(index) - ? const Icon( - Icons.favorite, - size: 25, - color: Colors.red, - ) - : const Icon( - Icons.favorite_border, - size: 25, - ), - ); - }, - ), + ), + Text( + AppConstants.modules[index].description, + style: Theme.of(context) + .textTheme + .bodyMedium! + .copyWith( + color: Colors.white, + fontWeight: FontWeight.bold, + shadows: [ + const Shadow( + color: Colors.black, + offset: Offset(2, 1), + blurRadius: 2, ), ], - ) - ], - ), - )), - ); - }, - childCount: AppConstants.modules.length, + ), + ), + ], + ), + ), + ), + ], + ), + ), + ), + ); + }, + childCount: AppConstants.modules.length, + ), + ), + GestureDetector( + onTap: () { + Navigator.pushNamed( + context, + AllRoutesConstant.drawingboardRoute, + ); + }, + child: Container( + margin: const EdgeInsets.all(5.0), + padding: const EdgeInsets.all(8.0), + decoration: BoxDecoration( + border: Border.all(color: Colors.black, width: 1.0), + borderRadius: BorderRadius.circular(8.0), + color: Colors.greenAccent, + ), + child: Row( + children: [ + SizedBox( + width: 50, + height: 50, + child: SvgPicture.asset( + 'assets/explore/drawing_board.svg', + ), + ), + const SizedBox(width: 28.0), + const Text( + 'Drawing Board', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 30.0, + fontFamily: 'Comic', + color: Colors.white, ), ), ], ), ), - drawer: const MyDrawer(), - ); + ), + ], + ), + ); } } + + // GestureDetector( + // onTap: () { + // Navigator.pushNamed(context, '/quiz'); + // }, + // child: Container( + // margin: const EdgeInsets.all(5.0), + // padding: const EdgeInsets.all(8.0), + // decoration: BoxDecoration( + // border: Border.all(color: Colors.black, width: 1.0), + // borderRadius: BorderRadius.circular(8.0), + // color: Colors.blueAccent, + // ), + // child: Row( + // children: [ + // SizedBox( + // width: 50, + // height: 50, + // child: SvgPicture.asset('assets/explore/notebook.svg'), + // ), + // const SizedBox(width: 28.0), + // const Text( + // 'Quiz', + // style: TextStyle( + // fontWeight: FontWeight.bold, + // fontSize: 30.0, + // fontFamily: 'Comic', + // color: Colors.white, + // ), + // ), + // ], + // ), + // ), + // ), diff --git a/lib/pages/modules/atoz.dart b/lib/pages/modules/atoz.dart index 0ad6c1c..72b1a8f 100644 --- a/lib/pages/modules/atoz.dart +++ b/lib/pages/modules/atoz.dart @@ -251,16 +251,10 @@ class _AtoZState extends State { alignment: Alignment.centerRight, child: ElevatedButton( style: ButtonStyle( -<<<<<<< HEAD - backgroundColor: isTimerEnabled - ? MaterialStateProperty.all(Colors.green) - : MaterialStateProperty.all(Colors.red), -======= // ignore: deprecated_member_use backgroundColor: MaterialStateProperty.all( isTimerEnabled ? Colors.green : Colors.red, ), ->>>>>>> upstream/master ), onPressed: () { setState(() { diff --git a/pubspec.yaml b/pubspec.yaml index d84972a..ef7718b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -47,11 +47,11 @@ dependencies: animated_text_kit: ^4.2.2 font_awesome_flutter: ^10.1.0 shared_preferences: ^2.2.3 + provider: ^6.1.2 dev_dependencies: flutter_test: sdk: flutter - provider: ^6.0.3 # The "flutter_lints" package below contains a set of recommended lints to # encourage good coding practices. The lint set provided by the package is