build method
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) {
return Scaffold(
backgroundColor: bgLight,
body: AmbientBackground(
child: SafeArea(
child: ListView(
padding: const EdgeInsets.fromLTRB(20, 12, 20, 28),
physics: const BouncingScrollPhysics(),
children: [
Row(
children: [
CupertinoButton(
padding: EdgeInsets.zero,
minimumSize: const Size(44, 44),
onPressed: () => Navigator.pop(context),
child: Icon(CupertinoIcons.chevron_left, color: textDark, size: 28),
),
const SizedBox(width: 12),
Text(
'Terms & Privacy',
style: headingStyle(fontSize: 18, color: textDark),
),
],
),
const SizedBox(height: 24),
_Section(
title: 'Terms of Service',
content: 'By using this application, you agree to the following terms:\n\n'
'1. You will use the app for lawful purposes only.\n\n'
'2. You are responsible for maintaining the confidentiality of your account.\n\n'
'3. We reserve the right to modify or discontinue the service at any time.\n\n'
'4. We are not liable for any damages arising from your use of the app.\n\n'
'5. These terms may be updated from time to time without prior notice.',
),
const SizedBox(height: 20),
_Section(
title: 'Privacy Policy',
content: 'Your privacy is important to us:\n\n'
'1. Data Storage: All data is stored locally on your device using Hive.\n\n'
'2. No Tracking: We do not collect or track your personal data.\n\n'
'3. Cloud Sync: If enabled, data is synced to your personal cloud storage only.\n\n'
'4. No Third Parties: We do not share your data with third parties.\n\n'
'5. You can delete all your data at any time from the app settings.',
),
const SizedBox(height: 20),
_Section(
title: 'Data Collection',
content: 'This app collects minimal data:\n\n'
'- Display name and email (provided by you)\n'
'- App preferences (dark mode, theme, notifications)\n'
'- Created content (items, notes, etc.)\n\n'
'All data remains on your device unless cloud sync is enabled.',
),
const SizedBox(height: 24),
Text(
'Last updated: January 2025',
style: bodyStyle(color: textMid, fontSize: 13),
textAlign: TextAlign.center,
),
],
),
),
),
);
}