build method
- BuildContext context,
- WidgetRef ref
Describes the part of the user interface represented by this widget.
The framework calls this method when this widget is inserted into the tree in a given BuildContext and when the dependencies of this widget change (e.g., an InheritedWidget referenced by this widget changes). This method can potentially be called in every frame and should not have any side effects beyond building a widget.
The framework replaces the subtree below this widget with the widget returned by this method, either by updating the existing subtree or by removing the subtree and inflating a new subtree, depending on whether the widget returned by this method can update the root of the existing subtree, as determined by calling Widget.canUpdate.
Typically implementations return a newly created constellation of widgets that are configured with information from this widget's constructor and from the given BuildContext.
The given BuildContext contains information about the location in the tree at which this widget is being built. For example, the context provides the set of inherited widgets for this location in the tree. A given widget might be built with multiple different BuildContext arguments over time if the widget is moved around the tree or if the widget is inserted into the tree in multiple places at once.
The implementation of this method must only depend on:
- the fields of the widget, which themselves must not change over time, and
- any ambient state obtained from the
contextusing BuildContext.dependOnInheritedWidgetOfExactType.
If a widget's build method is to depend on anything else, use a StatefulWidget instead.
See also:
- StatelessWidget, which contains the discussion on performance considerations.
Implementation
@override
Widget build(BuildContext context, WidgetRef ref) {
final theme = Theme.of(context);
return Scaffold(
appBar: AppBar(title: const Text('Create Curriculum')),
body: WebContentFrame(
variant: WebLayoutVariant.narrow,
child: ListView(
padding: const EdgeInsets.all(20),
children: [
// Hero section
Container(
padding: const EdgeInsets.all(24),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
DuTaToTheme.primary.withValues(alpha: 0.1),
DuTaToTheme.secondary.withValues(alpha: 0.1),
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderRadius: BorderRadius.circular(16),
),
child: Column(
children: [
const Icon(
Icons.auto_awesome_rounded,
size: 48,
color: DuTaToTheme.primary,
),
const SizedBox(height: 12),
Text(
'AI-Powered Curriculum Creator',
style: theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
const SizedBox(height: 8),
Text(
'Transform any source material into a structured learning curriculum using an AI agent.',
style: theme.textTheme.bodyMedium?.copyWith(
color: theme.colorScheme.onSurfaceVariant,
),
textAlign: TextAlign.center,
),
],
),
),
const SizedBox(height: 24),
// How it works
Text(
'How It Works',
style: theme.textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 12),
const _StepCard(
step: 1,
title: 'Fork the Tool',
description:
'Fork the Curriculum Creator repo into your own private GitHub repo.',
icon: Icons.fork_right_rounded,
),
const _StepCard(
step: 2,
title: 'Launch an AI Agent',
description:
'Start a Claude Code (Opus) or Codex session in the tool directory.',
icon: Icons.smart_toy_rounded,
),
const _StepCard(
step: 3,
title: 'Provide Your Sources',
description:
'Give the agent your PDFs, URLs, code repos, slides, or CSV files.',
icon: Icons.source_rounded,
),
const _StepCard(
step: 4,
title: 'Review & Approve',
description:
'The agent analyzes content, builds a topic hierarchy, and asks for your approval.',
icon: Icons.checklist_rounded,
),
const _StepCard(
step: 5,
title: 'Upload to DuTaTo',
description:
'Upload the generated curriculum and start learning.',
icon: Icons.cloud_upload_rounded,
),
const SizedBox(height: 24),
// Get the tool
Text(
'Get the Tool',
style: theme.textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 12),
Card(
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Fork this repo to get your own private copy of the Curriculum Creator tool.',
style: theme.textTheme.bodyMedium,
),
const SizedBox(height: 12),
Row(
children: [
Expanded(
child: FilledButton.tonalIcon(
onPressed: () => launchUrl(
Uri.parse(_repoUrl),
mode: LaunchMode.externalApplication,
),
icon: const Icon(Icons.fork_right_rounded),
label: const Text('Fork on GitHub'),
),
),
const SizedBox(width: 8),
IconButton(
icon: const Icon(Icons.copy_rounded, size: 20),
tooltip: 'Copy repo URL',
onPressed: () {
Clipboard.setData(
const ClipboardData(text: _repoUrl),
);
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Repo URL copied to clipboard'),
),
);
},
),
],
),
],
),
),
),
const SizedBox(height: 24),
// Supported sources
Text(
'Supported Sources',
style: theme.textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 12),
const Wrap(
spacing: 8,
runSpacing: 8,
children: [
_SourceChip(label: 'PDF', icon: Icons.picture_as_pdf_rounded),
_SourceChip(label: 'Word', icon: Icons.description_rounded),
_SourceChip(label: 'PowerPoint', icon: Icons.slideshow_rounded),
_SourceChip(label: 'URL', icon: Icons.link_rounded),
_SourceChip(label: 'Code', icon: Icons.code_rounded),
_SourceChip(label: 'CSV', icon: Icons.table_chart_rounded),
_SourceChip(label: 'Notion', icon: Icons.note_rounded),
],
),
const SizedBox(height: 24),
// Actions
FilledButton.icon(
onPressed: () => context.go('/domains/upload-curriculum'),
icon: const Icon(Icons.upload_file_rounded),
label: const Text('Upload Existing Output'),
),
const SizedBox(height: 80),
],
),
),
);
}