diff --git a/lib/studies/starter/home.dart b/lib/studies/starter/home.dart index 55c6c92ae1..05f34fb616 100644 --- a/lib/studies/starter/home.dart +++ b/lib/studies/starter/home.dart @@ -1,203 +1,107 @@ -// Copyright 2019 The Flutter team. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - import 'package:flutter/material.dart'; -import 'package:flutter_gen/gen_l10n/gallery_localizations.dart'; -import 'package:gallery/layout/adaptive.dart'; +class Category { + final String name; + final String imageUrl; -const appBarDesktopHeight = 128.0; + Category(this.name, this.imageUrl); +} -class HomePage extends StatelessWidget { - const HomePage({super.key}); +void main() => runApp(const CardExampleApp()); + +class CardExampleApp extends StatelessWidget { + const CardExampleApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { - final textTheme = Theme.of(context).textTheme; - final colorScheme = Theme.of(context).colorScheme; - final isDesktop = isDisplayDesktop(context); - final localizations = GalleryLocalizations.of(context)!; - final body = SafeArea( - child: Padding( - padding: isDesktop - ? const EdgeInsets.symmetric(horizontal: 72, vertical: 48) - : const EdgeInsets.symmetric(horizontal: 16, vertical: 24), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SelectableText( - localizations.starterAppGenericHeadline, - style: textTheme.displaySmall!.copyWith( - color: colorScheme.onSecondary, - ), - ), - const SizedBox(height: 10), - SelectableText( - localizations.starterAppGenericSubtitle, - style: textTheme.titleMedium, - ), - const SizedBox(height: 48), - SelectableText( - localizations.starterAppGenericBody, - style: textTheme.bodyLarge, - ), - ], - ), - ), + return MaterialApp( + home: const HomePage(), ); - - if (isDesktop) { - return Row( - children: [ - const ListDrawer(), - const VerticalDivider(width: 1), - Expanded( - child: Scaffold( - appBar: const AdaptiveAppBar( - isDesktop: true, - ), - body: body, - floatingActionButton: FloatingActionButton.extended( - heroTag: 'Extended Add', - onPressed: () {}, - label: Text( - localizations.starterAppGenericButton, - style: TextStyle(color: colorScheme.onSecondary), - ), - icon: Icon(Icons.add, color: colorScheme.onSecondary), - tooltip: localizations.starterAppTooltipAdd, - ), - ), - ), - ], - ); - } else { - return Scaffold( - appBar: const AdaptiveAppBar(), - body: body, - drawer: const ListDrawer(), - floatingActionButton: FloatingActionButton( - heroTag: 'Add', - onPressed: () {}, - tooltip: localizations.starterAppTooltipAdd, - child: Icon( - Icons.add, - color: Theme.of(context).colorScheme.onSecondary, - ), - ), - ); - } } } -class AdaptiveAppBar extends StatelessWidget implements PreferredSizeWidget { - const AdaptiveAppBar({ - super.key, - this.isDesktop = false, - }); - - final bool isDesktop; - - @override - Size get preferredSize => isDesktop - ? const Size.fromHeight(appBarDesktopHeight) - : const Size.fromHeight(kToolbarHeight); +class HomePage extends StatelessWidget { + const HomePage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { - final themeData = Theme.of(context); - final localizations = GalleryLocalizations.of(context)!; - return AppBar( - automaticallyImplyLeading: !isDesktop, - title: isDesktop - ? null - : SelectableText(localizations.starterAppGenericTitle), - bottom: isDesktop - ? PreferredSize( - preferredSize: const Size.fromHeight(26), - child: Container( - alignment: AlignmentDirectional.centerStart, - margin: const EdgeInsetsDirectional.fromSTEB(72, 0, 0, 22), - child: SelectableText( - localizations.starterAppGenericTitle, - style: themeData.textTheme.titleLarge!.copyWith( - color: themeData.colorScheme.onPrimary, - ), - ), - ), - ) - : null, - actions: [ - IconButton( - icon: const Icon(Icons.share), - tooltip: localizations.starterAppTooltipShare, - onPressed: () {}, - ), - IconButton( - icon: const Icon(Icons.favorite), - tooltip: localizations.starterAppTooltipFavorite, - onPressed: () {}, - ), - IconButton( - icon: const Icon(Icons.search), - tooltip: localizations.starterAppTooltipSearch, - onPressed: () {}, - ), - ], + return Scaffold( + appBar: AppBar(title: const Text('Talk Ease')), + body: CardExample(), ); } } -class ListDrawer extends StatefulWidget { - const ListDrawer({super.key}); +class CardExample extends StatelessWidget { + CardExample({Key? key}) : super(key: key); - @override - State createState() => _ListDrawerState(); -} - -class _ListDrawerState extends State { - static const numItems = 9; - - int selectedItem = 0; + // List of categories with names and image URLs + final List categories = [ + Category('Hungry', 'web/assets/Hungry.png'), + Category('Thirsty', 'web/assets/Thirsty.png'), + Category('Bathroom', 'web/assets/Bathroom.png'), + Category('Play', 'web/assets/I want to play legos.png'), + + // Add more categories with names and image URLs + ]; @override Widget build(BuildContext context) { - final textTheme = Theme.of(context).textTheme; - final localizations = GalleryLocalizations.of(context)!; - return Drawer( - child: SafeArea( - child: ListView( - children: [ - ListTile( - title: SelectableText( - localizations.starterAppTitle, - style: textTheme.titleLarge, - ), - subtitle: SelectableText( - localizations.starterAppGenericSubtitle, - style: textTheme.bodyMedium, - ), + return ListView.builder( + itemCount: 3, // Number of rows + itemBuilder: (context, rowIndex) { + return Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + children: List.generate( + 3, // Number of cards in each row + (cardIndex) { + int categoryIndex = rowIndex * 3 + cardIndex; + + // Check if categoryIndex is within the categories list bounds + if (categoryIndex < categories.length) { + Category category = categories[categoryIndex]; + + return SizedBox( + width: 150, + height: 150, + child: Card( + semanticContainer: true, + clipBehavior: Clip.antiAliasWithSaveLayer, + child: Container( + decoration: BoxDecoration( + image: DecorationImage( + image: NetworkImage(category.imageUrl), + fit: BoxFit.cover, + ), + ), + child: Center( + // You can customize the content inside the card here + // For example, you can add a Text widget to display the category name + child: Text( + category.name, + style: TextStyle( + fontSize: 16, + color: Colors.white, + ), + ), + ), + ), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + elevation: 5, + margin: EdgeInsets.all(10), + ), + ); + } else { + return Container(); // Placeholder for empty spaces + } + }, ), - const Divider(), - ...Iterable.generate(numItems).toList().map((i) { - return ListTile( - enabled: true, - selected: i == selectedItem, - leading: const Icon(Icons.favorite), - title: Text( - localizations.starterAppDrawerItem(i + 1), - ), - onTap: () { - setState(() { - selectedItem = i; - }); - }, - ); - }), - ], - ), - ), + ), + ); + }, ); } } diff --git a/pubspec.lock b/pubspec.lock index 9a0b0728f8..32ca30524e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -101,10 +101,10 @@ packages: dependency: transitive description: name: coverage - sha256: "8acabb8306b57a409bf4c83522065672ee13179297a6bb0cb9ead73948df7c76" + sha256: "595a29b55ce82d53398e1bcc2cba525d7bd7c59faeb2d2540e9d42c390cfeeeb" url: "https://pub.dev" source: hosted - version: "1.7.2" + version: "1.6.4" crypto: dependency: transitive description: @@ -149,10 +149,10 @@ packages: dependency: transitive description: name: file - sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" url: "https://pub.dev" source: hosted - version: "7.0.0" + version: "6.1.4" flutter: dependency: "direct main" description: flutter @@ -311,22 +311,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.6.7" - leak_tracker: - dependency: transitive - description: - name: leak_tracker - sha256: "04be76c4a4bb50f14904e64749237e541e7c7bcf7ec0b196907322ab5d2fc739" - url: "https://pub.dev" - source: hosted - version: "9.0.16" - leak_tracker_testing: - dependency: transitive - description: - name: leak_tracker_testing - sha256: b06739349ec2477e943055aea30172c5c7000225f79dad4702e2ec0eda79a6ff - url: "https://pub.dev" - source: hosted - version: "1.0.5" lints: dependency: transitive description: @@ -355,18 +339,18 @@ packages: dependency: transitive description: name: material_color_utilities - sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" url: "https://pub.dev" source: hosted - version: "0.8.0" + version: "0.5.0" meta: dependency: "direct main" description: name: meta - sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.10.0" mime: dependency: transitive description: @@ -459,10 +443,10 @@ packages: dependency: transitive description: name: platform - sha256: "0a279f0707af40c890e80b1e9df8bb761694c074ba7e1d4ab1bc4b728e200b59" + sha256: ae68c7bfcd7383af3629daafb32fb4e8681c7154428da4febcff06200585f102 url: "https://pub.dev" source: hosted - version: "3.1.3" + version: "3.1.2" plugin_platform_interface: dependency: transitive description: @@ -483,10 +467,10 @@ packages: dependency: transitive description: name: process - sha256: "266ca5be5820feefc777793d0a583acfc8c40834893c87c00c6c09e2cf58ea42" + sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" url: "https://pub.dev" source: hosted - version: "5.0.1" + version: "4.2.4" provider: dependency: "direct main" description: @@ -744,10 +728,10 @@ packages: dependency: transitive description: name: vm_service - sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + sha256: c538be99af830f478718b51630ec1b6bee5e74e52c8a802d328d9e71d35d2583 url: "https://pub.dev" source: hosted - version: "13.0.0" + version: "11.10.0" watcher: dependency: transitive description: @@ -760,10 +744,10 @@ packages: dependency: transitive description: name: web - sha256: edc8a9573dd8c5a83a183dae1af2b6fd4131377404706ca4e5420474784906fa + sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 url: "https://pub.dev" source: hosted - version: "0.4.0" + version: "0.3.0" web_benchmarks: dependency: "direct dev" description: @@ -784,10 +768,10 @@ packages: dependency: transitive description: name: webdriver - sha256: "003d7da9519e1e5f329422b36c4dcdf18d7d2978d1ba099ea4e45ba490ed845e" + sha256: "3c923e918918feeb90c4c9fdf1fe39220fa4c0e8e2c0fffaded174498ef86c49" url: "https://pub.dev" source: hosted - version: "3.0.3" + version: "3.0.2" webkit_inspection_protocol: dependency: transitive description: diff --git a/web/assets/1.png b/web/assets/1.png new file mode 100644 index 0000000000..9cbae37658 Binary files /dev/null and b/web/assets/1.png differ diff --git a/web/assets/10.png b/web/assets/10.png new file mode 100644 index 0000000000..b0d4d39e65 Binary files /dev/null and b/web/assets/10.png differ diff --git a/web/assets/11.png b/web/assets/11.png new file mode 100644 index 0000000000..be02ef4ade Binary files /dev/null and b/web/assets/11.png differ diff --git a/web/assets/12.png b/web/assets/12.png new file mode 100644 index 0000000000..8e3acf0ae7 Binary files /dev/null and b/web/assets/12.png differ diff --git a/web/assets/15.png b/web/assets/15.png new file mode 100644 index 0000000000..0733d168f8 Binary files /dev/null and b/web/assets/15.png differ diff --git a/web/assets/16.png b/web/assets/16.png new file mode 100644 index 0000000000..3fb5cddc92 Binary files /dev/null and b/web/assets/16.png differ diff --git a/web/assets/2.png b/web/assets/2.png new file mode 100644 index 0000000000..516098dabf Binary files /dev/null and b/web/assets/2.png differ diff --git a/web/assets/3.png b/web/assets/3.png new file mode 100644 index 0000000000..cfcab8eb50 Binary files /dev/null and b/web/assets/3.png differ diff --git a/web/assets/Bathroom.png b/web/assets/Bathroom.png new file mode 100644 index 0000000000..7e98e22c6e Binary files /dev/null and b/web/assets/Bathroom.png differ diff --git a/web/assets/Calendar.png b/web/assets/Calendar.png new file mode 100644 index 0000000000..1c50a96f53 Binary files /dev/null and b/web/assets/Calendar.png differ diff --git a/web/assets/Hungry.png b/web/assets/Hungry.png new file mode 100644 index 0000000000..49a575292d Binary files /dev/null and b/web/assets/Hungry.png differ diff --git a/web/assets/I want to play legos.png b/web/assets/I want to play legos.png new file mode 100644 index 0000000000..447f06a7f6 Binary files /dev/null and b/web/assets/I want to play legos.png differ diff --git a/web/assets/I want to play with a car.png b/web/assets/I want to play with a car.png new file mode 100644 index 0000000000..c8e12fbb0f Binary files /dev/null and b/web/assets/I want to play with a car.png differ diff --git a/web/assets/I want to play with a doll.png b/web/assets/I want to play with a doll.png new file mode 100644 index 0000000000..29cba7bd12 Binary files /dev/null and b/web/assets/I want to play with a doll.png differ diff --git a/web/assets/I want to run the water.png b/web/assets/I want to run the water.png new file mode 100644 index 0000000000..3e13c893cf Binary files /dev/null and b/web/assets/I want to run the water.png differ diff --git a/web/assets/I want to slide.png b/web/assets/I want to slide.png new file mode 100644 index 0000000000..5b59da5fc9 Binary files /dev/null and b/web/assets/I want to slide.png differ diff --git a/web/assets/I want to use the potty.png b/web/assets/I want to use the potty.png new file mode 100644 index 0000000000..2d7ef10e34 Binary files /dev/null and b/web/assets/I want to use the potty.png differ diff --git a/web/assets/Image.png b/web/assets/Image.png new file mode 100644 index 0000000000..492cdeac08 Binary files /dev/null and b/web/assets/Image.png differ diff --git a/web/assets/Messages.png b/web/assets/Messages.png new file mode 100644 index 0000000000..f5e24abb28 Binary files /dev/null and b/web/assets/Messages.png differ diff --git a/web/assets/Note.png b/web/assets/Note.png new file mode 100644 index 0000000000..217f0dfb98 Binary files /dev/null and b/web/assets/Note.png differ diff --git a/web/assets/Picture.png b/web/assets/Picture.png new file mode 100644 index 0000000000..6953341c6d Binary files /dev/null and b/web/assets/Picture.png differ diff --git a/web/assets/Schedule.png b/web/assets/Schedule.png new file mode 100644 index 0000000000..6cac9681d3 Binary files /dev/null and b/web/assets/Schedule.png differ diff --git a/web/assets/Settings.png b/web/assets/Settings.png new file mode 100644 index 0000000000..d63628c298 Binary files /dev/null and b/web/assets/Settings.png differ diff --git a/web/assets/Shop Features.png b/web/assets/Shop Features.png new file mode 100644 index 0000000000..09123a7f81 Binary files /dev/null and b/web/assets/Shop Features.png differ diff --git a/web/assets/Thirsty.png b/web/assets/Thirsty.png new file mode 100644 index 0000000000..f48297a950 Binary files /dev/null and b/web/assets/Thirsty.png differ diff --git a/web/assets/Time for School.png b/web/assets/Time for School.png new file mode 100644 index 0000000000..ebe40d5f0c Binary files /dev/null and b/web/assets/Time for School.png differ