Stworz aplikacje mobilna
- User
Stworz aplikacje mobilna
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Stworz aplikacje mobilna
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Poniżej znajduje się przykładowy kod aplikacji To-Do List napisanej w Flutterze:
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'To-Do List',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: TodoListScreen(),
);
}
}
class TodoListScreen extends StatefulWidget {
@override
_TodoListScreenState createState() => _TodoListScreenState();
}
class _TodoListScreenState extends State<TodoListScreen> {
List<String> tasks = [];
TextEditingController taskController = TextEditingController();
void addTask() {
setState(() {
tasks.add(taskController.text);
taskController.clear();
});
}
void removeTask(int index) {
setState(() {
tasks.removeAt(index);
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('To-Do List'),
),
body: Column(
children: [
Padding(
padding: EdgeInsets.all(8.0),
child: Row(
children: [
Expanded(
child: TextField(
controller: taskController,
decoration: InputDecoration(
hintText: 'Enter a task',
),
),
),
IconButton(
icon: Icon(Icons.add),
onPressed: addTask,
),
],
),
),
Expanded(
child: ListView.builder(
itemCount: tasks.length,
itemBuilder: (context, index) {
return ListTile(
title: Text(tasks[index]),
trailing: IconButton(
icon: Icon(Icons.delete),
onPressed: () => removeTask(index),
),
);
},
),
),
],
),
);
}
}
Proces tworzenia aplikacji mobilnej jest złożony i wymaga uwzględnienia wielu aspektów, od projektowania po wdrożenie i utrzymanie. Wybór odpowiednich narzędzi i technologii jest kluczowy dla sukcesu projektu.